Class: Reporta::Form
- Inherits:
-
Object
- Object
- Reporta::Form
- Includes:
- ActiveModel::Conversion, ActiveModel::Validations
- Defined in:
- lib/reporta/models/form.rb
Instance Attribute Summary collapse
-
#filter_applied ⇒ Object
Returns the value of attribute filter_applied.
-
#filters ⇒ Object
Returns the value of attribute filters.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #filter_applied? ⇒ Boolean
-
#initialize(filters, values = {}) ⇒ Form
constructor
A new instance of Form.
-
#persisted? ⇒ Boolean
This method is required so a Form instance can be passed into a form_for helper method.
Constructor Details
#initialize(filters, values = {}) ⇒ Form
Returns a new instance of Form.
38 39 40 41 42 43 44 |
# File 'lib/reporta/models/form.rb', line 38 def initialize(filters, values={}) @filters = filters @params = values self.class.send :attr_accessor, *filters.keys self.filter_applied = values.any? set_values filters, values end |
Instance Attribute Details
#filter_applied ⇒ Object
Returns the value of attribute filter_applied.
27 28 29 |
# File 'lib/reporta/models/form.rb', line 27 def filter_applied @filter_applied end |
#filters ⇒ Object
Returns the value of attribute filters.
27 28 29 |
# File 'lib/reporta/models/form.rb', line 27 def filters @filters end |
#params ⇒ Object
Returns the value of attribute params.
27 28 29 |
# File 'lib/reporta/models/form.rb', line 27 def params @params end |
Instance Method Details
#filter_applied? ⇒ Boolean
46 47 48 |
# File 'lib/reporta/models/form.rb', line 46 def filter_applied? self.filter_applied end |
#persisted? ⇒ Boolean
This method is required so a Form instance can be passed into a form_for helper method
52 53 54 |
# File 'lib/reporta/models/form.rb', line 52 def persisted? false end |