Class: AutoForme::Request
- Inherits:
-
Object
- Object
- AutoForme::Request
- Defined in:
- lib/autoforme/request.rb
Overview
Request wraps a specific web request for a given framework.
Direct Known Subclasses
Frameworks::Rails::Request, Frameworks::Roda::Request, Frameworks::Sinatra::Request
Instance Attribute Summary collapse
-
#action_type ⇒ Object
readonly
A string representing the action type for the request.
-
#controller ⇒ Object
readonly
The underlying web framework request instance for the request.
-
#id ⇒ Object
readonly
The id related to the request, which is usually the primary key of the related model instance, but for browse/search pages is used as the page.
-
#method ⇒ Object
readonly
The request method (GET or POST) for the request.
-
#model ⇒ Object
readonly
A string representing the model for the request.
-
#params ⇒ Object
readonly
The params for the current request.
-
#path ⇒ Object
readonly
A string representing the path that the root of the application is mounted at.
-
#session ⇒ Object
readonly
The session variables for the current request.
Instance Method Summary collapse
-
#post? ⇒ Boolean
Whether the current request used the POST HTTP method.
-
#query_string ⇒ Object
The query string for the current request.
-
#set_flash_notice(message) ⇒ Object
Set the flash at notice level when redirecting, so it shows up on the redirected page.
-
#set_flash_now_error(message) ⇒ Object
Set the current flash at error level, used when displaying pages when there is an error.
Instance Attribute Details
#action_type ⇒ Object (readonly)
A string representing the action type for the request
14 15 16 |
# File 'lib/autoforme/request.rb', line 14 def action_type @action_type end |
#controller ⇒ Object (readonly)
The underlying web framework request instance for the request
5 6 7 |
# File 'lib/autoforme/request.rb', line 5 def controller @controller end |
#id ⇒ Object (readonly)
The id related to the request, which is usually the primary key of the related model instance, but for browse/search pages is used as the page
23 24 25 |
# File 'lib/autoforme/request.rb', line 23 def id @id end |
#method ⇒ Object (readonly)
The request method (GET or POST) for the request
8 9 10 |
# File 'lib/autoforme/request.rb', line 8 def method @method end |
#model ⇒ Object (readonly)
A string representing the model for the request
11 12 13 |
# File 'lib/autoforme/request.rb', line 11 def model @model end |
#params ⇒ Object (readonly)
The params for the current request
26 27 28 |
# File 'lib/autoforme/request.rb', line 26 def params @params end |
#path ⇒ Object (readonly)
A string representing the path that the root of the application is mounted at
18 19 20 |
# File 'lib/autoforme/request.rb', line 18 def path @path end |
#session ⇒ Object (readonly)
The session variables for the current request
29 30 31 |
# File 'lib/autoforme/request.rb', line 29 def session @session end |
Instance Method Details
#post? ⇒ Boolean
Whether the current request used the POST HTTP method.
32 33 34 |
# File 'lib/autoforme/request.rb', line 32 def post? method == 'POST' end |
#query_string ⇒ Object
The query string for the current request
37 38 39 |
# File 'lib/autoforme/request.rb', line 37 def query_string @env['QUERY_STRING'] end |
#set_flash_notice(message) ⇒ Object
Set the flash at notice level when redirecting, so it shows up on the redirected page.
43 44 45 |
# File 'lib/autoforme/request.rb', line 43 def set_flash_notice() @controller.flash[:notice] = end |
#set_flash_now_error(message) ⇒ Object
Set the current flash at error level, used when displaying pages when there is an error.
49 50 51 |
# File 'lib/autoforme/request.rb', line 49 def set_flash_now_error() @controller.flash.now[:error] = end |