Module: Informal::ModelNoInit
- Defined in:
- lib/informal/model_no_init.rb
Class Method Summary collapse
Instance Method Summary collapse
- #attributes=(attrs) ⇒ Object
- #new_record? ⇒ Boolean
- #persisted? ⇒ Boolean
- #to_key ⇒ Object
- #to_model ⇒ Object
- #to_param ⇒ Object
Class Method Details
.included(klass) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/informal/model_no_init.rb', line 4 def self.included(klass) klass.class_eval do extend ActiveModel::Naming include ActiveModel::Validations end end |
Instance Method Details
#attributes=(attrs) ⇒ Object
11 12 13 |
# File 'lib/informal/model_no_init.rb', line 11 def attributes=(attrs) attrs.each_pair { |name, value| self.send("#{name}=", value) } end |
#new_record? ⇒ Boolean
19 20 21 |
# File 'lib/informal/model_no_init.rb', line 19 def new_record? true end |
#persisted? ⇒ Boolean
15 16 17 |
# File 'lib/informal/model_no_init.rb', line 15 def persisted? false end |
#to_key ⇒ Object
27 28 29 |
# File 'lib/informal/model_no_init.rb', line 27 def to_key [object_id] end |
#to_model ⇒ Object
23 24 25 |
# File 'lib/informal/model_no_init.rb', line 23 def to_model self end |
#to_param ⇒ Object
31 32 33 |
# File 'lib/informal/model_no_init.rb', line 31 def to_param nil end |