Created
June 19, 2013 06:38
-
-
Save jamesbrooks/5812100 to your computer and use it in GitHub Desktop.
Rails - Internal Requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def internal_request(path, params={}) | |
request_env = Rack::MockRequest.env_for(path, params: params.to_query).merge({ | |
'rack.session' => session | |
}) | |
Rails.application.routes.call(request_env).last.body | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment