| Module | Sequel::Plugins::ActiveModel::InstanceMethods |
| In: |
lib/sequel/plugins/active_model.rb
|
| DEFAULT_TO_PARAM_JOINER | = | '-'.freeze | The default string to join composite primary keys with in to_param. |
Record that an object was destroyed, for later use by destroyed?
# File lib/sequel/plugins/active_model.rb, line 27
27: def after_destroy
28: super
29: @destroyed = true
30: end
False if the object is new? or has been destroyed, true otherwise.
# File lib/sequel/plugins/active_model.rb, line 33
33: def persisted?
34: !new? && @destroyed != true
35: end
An array of primary key values, or nil if the object is not persisted.
# File lib/sequel/plugins/active_model.rb, line 38
38: def to_key
39: if persisted?
40: primary_key.is_a?(Symbol) ? [pk] : pk
41: end
42: end
With the ActiveModel plugin, Sequel model objects are already compliant, so this returns self.
# File lib/sequel/plugins/active_model.rb, line 46
46: def to_model
47: self
48: end