Class/Module Index [+]

Quicksearch

Sequel::Plugins::ActiveModel::InstanceMethods

Constants

DEFAULT_TO_PARAM_JOINER

The default string to join composite primary keys with in to_param.

Public Instance Methods

after_destroy() click to toggle source

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

# File lib/sequel/plugins/active_model.rb, line 27
def after_destroy
  super
  @destroyed = true
end
persisted?() click to toggle source

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

# File lib/sequel/plugins/active_model.rb, line 33
def persisted?
  !new? && @destroyed != true
end
to_key() click to toggle source

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

# File lib/sequel/plugins/active_model.rb, line 38
def to_key
  if persisted?
    primary_key.is_a?(Symbol) ? [pk] : pk
  end
end
to_model() click to toggle source

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

# File lib/sequel/plugins/active_model.rb, line 46
def to_model
  self
end
to_param() click to toggle source

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

# File lib/sequel/plugins/active_model.rb, line 52
def to_param
  if k = to_key
    k.join(to_param_joiner)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.