module Praxis::Plugins::RailsPlugin::Controller
Public Instance Methods
Source
# File lib/praxis/plugins/rails_plugin.rb, line 88 def head(status, options = {}) if status.is_a?(Hash) options = status status = nil end status ||= options.delete(:status) || :ok location = options.delete(:location) content_type = options.delete(:content_type) code = Rack::Utils::SYMBOL_TO_STATUS_CODE[status] response = Praxis::Response.new(status: code, body: status.to_s, location: location) options.each do |key, value| response.headers[key.to_s.dasherize.split('-').each { |v| v[0] = v[0].chr.upcase }.join('-')] = value.to_s end response.content_type = content_type if content_type response end
Source
# File lib/praxis/plugins/rails_plugin.rb, line 70 def headers response.headers end
Allow accessing the response headers from the controller
Source
# File lib/praxis/plugins/rails_plugin.rb, line 65 def params request.parameters end
Expose a rails-version of params from the controller Avoid using them explicitly in your controllers though. Use request.params object instead, as they are the Praxis
ones that have been validated and coerced into the types you’ve defined.
Source
# File lib/praxis/plugins/rails_plugin.rb, line 83 def response_body=(body) # TODO: @_rendered = true # Necessary to know if to stop filter chain or not... response.body = body end
Source
# File lib/praxis/plugins/rails_plugin.rb, line 74 def session request.session end
Source
# File lib/praxis/plugins/rails_plugin.rb, line 79 def status=(code) response.status = code end
Allow setting the status and body of the response from the controller itself.