Module: Sequel::Plugins::ActiveModel::InstanceMethods

Defined in:
lib/sequel/lib/sequel/plugins/active_model.rb

Instance Method Summary collapse

Instance Method Details

#after_destroyObject

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


11
12
13
14
# File 'lib/sequel/lib/sequel/plugins/active_model.rb', line 11

def after_destroy
  super
  @destroyed = true
end

#destroyed?Boolean

Whether the object was destroyed by destroy. Not true for objects that were deleted.


18
19
20
# File 'lib/sequel/lib/sequel/plugins/active_model.rb', line 18

def destroyed?
  @destroyed == true
end

#new_record?Boolean

An alias for new?


23
24
25
# File 'lib/sequel/lib/sequel/plugins/active_model.rb', line 23

def new_record?
  new?
end

#to_modelObject

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


29
30
31
# File 'lib/sequel/lib/sequel/plugins/active_model.rb', line 29

def to_model
  self
end