Skip to content

Instantly share code, notes, and snippets.

@jamesbrooks
Created June 19, 2013 06:38
Show Gist options
  • Save jamesbrooks/5812100 to your computer and use it in GitHub Desktop.
Save jamesbrooks/5812100 to your computer and use it in GitHub Desktop.
Rails - Internal Requests
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