Module: Merb::Orms::Sequel::Model::ActiveModelCompatibility

Defined in:
lib/merb/orms/sequel/model.rb

Overview

This code has been taken from Sequel 3.5.0 Sequel::Plugins::ActiveModel sequel.rubyforge.org/rdoc-plugins/classes/Sequel/Plugins/ActiveModel.html

Instance Method Summary collapse

Instance Method Details

#after_destroyObject

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



12
13
14
15
# File 'lib/merb/orms/sequel/model.rb', line 12

def after_destroy
  super
  @destroyed = true
end

#destroyed?Boolean

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

Returns:

  • (Boolean)


19
20
21
# File 'lib/merb/orms/sequel/model.rb', line 19

def destroyed?
  @destroyed == true
end

#new_record?Boolean

An alias for new?

Returns:

  • (Boolean)


24
25
26
# File 'lib/merb/orms/sequel/model.rb', line 24

def new_record?
  new?
end

#to_modelObject

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



30
31
32
# File 'lib/merb/orms/sequel/model.rb', line 30

def to_model
  self
end