class AutoForme::Request
Request
wraps a specific web request for a given framework.
Attributes
A string representing the action type for the request
The underlying web framework request instance for the request
The HTTP request environment hash
The id related to the request, which is usually the primary key of the related model instance.
The request method (GET or POST) for the request
A string representing the model for the request
The params for the current request
A string representing the path that the root of the application is mounted at
The session variables for the current request
Public Instance Methods
Whether the current request used the POST HTTP method.
# File lib/autoforme/request.rb 36 def post? 37 method == 'POST' 38 end
The query string for the current request
# File lib/autoforme/request.rb 41 def query_string 42 @env['QUERY_STRING'] 43 end
Set the flash at notice level when redirecting, so it shows up on the redirected page.
# File lib/autoforme/request.rb 47 def set_flash_notice(message) 48 @controller.flash[:notice] = message 49 end
Set the current flash at error level, used when displaying pages when there is an error.
# File lib/autoforme/request.rb 53 def set_flash_now_error(message) 54 @controller.flash.now[:error] = message 55 end
Private Instance Methods
# File lib/autoforme/request.rb 59 def set_id(path_id) 60 @id = path_id 61 if param_id = @params['id'] 62 case @action_type 63 when 'show', 'edit', 'delete', 'mtm_edit' 64 @id = param_id 65 end 66 end 67 @id = nil if @id && @id.empty? 68 end