Module: Perpetuity::RailsModel
- Defined in:
- lib/perpetuity/rails_model.rb
Defined Under Namespace
Modules: ActiveModelish
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
3 4 5 |
# File 'lib/perpetuity/rails_model.rb', line 3 def self.included klass klass.extend ActiveModelish end |
Instance Method Details
#model_name ⇒ Object
19 20 21 |
# File 'lib/perpetuity/rails_model.rb', line 19 def model_name self.class.model_name end |
#persisted? ⇒ Boolean
7 8 9 |
# File 'lib/perpetuity/rails_model.rb', line 7 def persisted? defined? @id end |
#to_key ⇒ Object
15 16 17 |
# File 'lib/perpetuity/rails_model.rb', line 15 def to_key [to_param] if persisted? end |
#to_model ⇒ Object
23 24 25 |
# File 'lib/perpetuity/rails_model.rb', line 23 def to_model self end |
#to_param ⇒ Object
11 12 13 |
# File 'lib/perpetuity/rails_model.rb', line 11 def to_param @id if persisted? end |