Class: Philtre::Filter::Model
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Philtre::Filter::Model
- Extended by:
- ActiveModel::Naming
- Defined in:
- lib/philtre-rails/philtre_model.rb
Overview
These define the interface as used by the views. So this class is available for custom predicates.
Class Method Summary collapse
-
.model_name ⇒ Object
Name this as ‘filter’, so the parameters come back from the form as that.
Instance Method Summary collapse
- #errors ⇒ Object
-
#persisted? ⇒ Boolean
Rest of ActiveModel compliance, because include ActiveModel::Model messes with initialize, which breaks OpenStruct.
- #to_key ⇒ Object
- #to_model ⇒ Object
- #to_param ⇒ Object
- #to_partial_path ⇒ Object
Class Method Details
.model_name ⇒ Object
Name this as ‘filter’, so the parameters come back from the form as that.
11 |
# File 'lib/philtre-rails/philtre_model.rb', line 11 def self.model_name; ActiveModel::Name.new(Philtre); end |
Instance Method Details
#errors ⇒ Object
19 |
# File 'lib/philtre-rails/philtre_model.rb', line 19 def errors; @errors ||= ActiveModel::Errors.new(self); end |
#persisted? ⇒ Boolean
Rest of ActiveModel compliance, because
include ActiveModel::Model
messes with initialize, which breaks OpenStruct
16 |
# File 'lib/philtre-rails/philtre_model.rb', line 16 def persisted?; false; end |
#to_key ⇒ Object
17 |
# File 'lib/philtre-rails/philtre_model.rb', line 17 def to_key; nil; end |
#to_model ⇒ Object
21 |
# File 'lib/philtre-rails/philtre_model.rb', line 21 def to_model; self; end |
#to_param ⇒ Object
18 |
# File 'lib/philtre-rails/philtre_model.rb', line 18 def to_param; nil; end |
#to_partial_path ⇒ Object
20 |
# File 'lib/philtre-rails/philtre_model.rb', line 20 def to_partial_path; self.class.model_name.param_key; end |