Module: DataMapper::ActiveModel::InstanceMethods
- Includes:
- ActiveModel::Conversion
- Defined in:
- lib/dm-active_model.rb
Instance Method Summary collapse
- #errors ⇒ Object
- #persisted? ⇒ Boolean
- #to_key ⇒ Object
- #to_model ⇒ Object
- #to_param ⇒ Object
- #valid? ⇒ Boolean
Instance Method Details
#errors ⇒ Object
44 45 46 47 48 49 |
# File 'lib/dm-active_model.rb', line 44 def errors obj = Object.new def obj.[](key) [] end def obj.() [] end obj end |
#persisted? ⇒ Boolean
18 19 20 |
# File 'lib/dm-active_model.rb', line 18 def persisted? saved? end |
#to_key ⇒ Object
22 23 24 |
# File 'lib/dm-active_model.rb', line 22 def to_key key end |
#to_model ⇒ Object
14 15 16 |
# File 'lib/dm-active_model.rb', line 14 def to_model self end |
#to_param ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/dm-active_model.rb', line 26 def to_param return nil if key.nil? if key.length > 1 raise "You need to implement #to_param yourself to support this key: #{self.class.key.inspect}" else self.key.first.to_s end end |
#valid? ⇒ Boolean
40 41 42 |
# File 'lib/dm-active_model.rb', line 40 def valid? true end |