Class: Effective::DatatableFiltersForm
- Inherits:
-
Object
- Object
- Effective::DatatableFiltersForm
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/effective/datatable_filters_form.rb
Instance Attribute Summary collapse
-
#scope ⇒ Object
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(datatable:) ⇒ DatatableFiltersForm
constructor
A new instance of DatatableFiltersForm.
Constructor Details
#initialize(datatable:) ⇒ DatatableFiltersForm
Returns a new instance of DatatableFiltersForm.
9 10 11 12 13 14 15 16 17 18 |
# File 'app/models/effective/datatable_filters_form.rb', line 9 def initialize(datatable:) # Assign the current value of scope assign_attributes(scope: datatable.state[:scope]) # Create an attr_accesor for each filter and assign value datatable._filters.each do |name, | self.class.send(:attr_accessor, name) assign_attributes(name => datatable.state[:filter][name]) end end |
Instance Attribute Details
#scope ⇒ Object
Returns the value of attribute scope.
7 8 9 |
# File 'app/models/effective/datatable_filters_form.rb', line 7 def scope @scope end |