Internal Requests in Rails (coderwall.com)
2020/01/01 10:14AM
def internal_request(path, params={})
request_env = Rack::MockRequest.env_for(path, params: params.to_query).merge({
'rack.session' => session # remove if session is unavailable/undesired in request
})
# Returns: [ status, headers, body ]
Rails.application.routes.call(request_env)
end
This is the method I built on top of for building a static site generator in Rails.