Class: Carnival::QueryForm
- Inherits:
-
Object
- Object
- Carnival::QueryForm
- Defined in:
- app/models/carnival/query_form.rb
Instance Attribute Summary collapse
-
#advanced_search ⇒ Object
Returns the value of attribute advanced_search.
-
#date_period_from ⇒ Object
Returns the value of attribute date_period_from.
-
#date_period_label ⇒ Object
Returns the value of attribute date_period_label.
-
#date_period_to ⇒ Object
Returns the value of attribute date_period_to.
-
#page ⇒ Object
Returns the value of attribute page.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#search_term ⇒ Object
Returns the value of attribute search_term.
-
#sort_column ⇒ Object
Returns the value of attribute sort_column.
-
#sort_direction ⇒ Object
Returns the value of attribute sort_direction.
Instance Method Summary collapse
-
#initialize(params) ⇒ QueryForm
constructor
A new instance of QueryForm.
- #to_hash ⇒ Object
Constructor Details
#initialize(params) ⇒ QueryForm
Returns a new instance of QueryForm.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/models/carnival/query_form.rb', line 7 def initialize(params) @scope = params[:scope] @search_term = params[:search_term] @date_period_label = params[:date_period_label] @date_period_from = params[:date_period_from] @date_period_to = params[:date_period_to] @sort_column = params[:sort_column] @sort_direction = params[:sort_direction] @advanced_search = params[:advanced_search] || {} @page = (params[:page] || 1).to_i end |
Instance Attribute Details
#advanced_search ⇒ Object
Returns the value of attribute advanced_search.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def advanced_search @advanced_search end |
#date_period_from ⇒ Object
Returns the value of attribute date_period_from.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def date_period_from @date_period_from end |
#date_period_label ⇒ Object
Returns the value of attribute date_period_label.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def date_period_label @date_period_label end |
#date_period_to ⇒ Object
Returns the value of attribute date_period_to.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def date_period_to @date_period_to end |
#page ⇒ Object
Returns the value of attribute page.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def page @page end |
#scope ⇒ Object
Returns the value of attribute scope.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def scope @scope end |
#search_term ⇒ Object
Returns the value of attribute search_term.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def search_term @search_term end |
#sort_column ⇒ Object
Returns the value of attribute sort_column.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def sort_column @sort_column end |
#sort_direction ⇒ Object
Returns the value of attribute sort_direction.
3 4 5 |
# File 'app/models/carnival/query_form.rb', line 3 def sort_direction @sort_direction end |
Instance Method Details
#to_hash ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/models/carnival/query_form.rb', line 20 def to_hash { 'scope' => scope, 'search_term' => search_term, 'date_period_label' => date_period_label, 'date_period_from' => date_period_from, 'date_period_to' => date_period_to, 'sort_column' => sort_column, 'sort_direction' => sort_direction, 'advanced_search' => advanced_search, 'page' => page } end |