Module | Sequel::Plugins::ActiveModel::InstanceMethods
In: | lib/sequel/plugins/active_model.rb

### Methods

after_destroy persisted? to_key to_model to_param

### Constants

DEFAULT_TO_PARAM_JOINER | = | '-'.freeze |  | The default string to join composite primary keys with in to_param.

### Public Instance methods

after_destroy()

Record that an object was destroyed, for later use by destroyed?

[Source]

        # File lib/sequel/plugins/active_model.rb, line 27
    27:         def after_destroy
    28:           super
    29:           @destroyed = true
    30:         end

persisted?()

False if the object is new? or has been destroyed, true otherwise.

[Source]

        # File lib/sequel/plugins/active_model.rb, line 33
    33:         def persisted?
    34:           !new? && @destroyed != true
    35:         end

to_key()

An array of primary key values, or nil if the object is not persisted.

[Source]

        # File lib/sequel/plugins/active_model.rb, line 38
    38:         def to_key
    39:           if primary_key.is_a?(Symbol)
    40:             [pk] if pk
    41:           else
    42:             pk if pk.all?
    43:           end
    44:         end

to_model()

With the ActiveModel plugin, Sequel model objects are already compliant, so this returns self.

[Source]

        # File lib/sequel/plugins/active_model.rb, line 48
    48:         def to_model
    49:           self
    50:         end

to_param()

An string representing the object‘s primary key. For composite primary keys, joins them with to_param_joiner.

[Source]

        # File lib/sequel/plugins/active_model.rb, line 54
    54:         def to_param
    55:           if persisted? and k = to_key
    56:             k.join(to_param_joiner)
    57:           end
    58:         end

[Validate]