Module: AMEE::Rails::ClassMethods

Defined in:
lib/amee/rails.rb

Instance Method Summary collapse

Instance Method Details

#has_amee_profile(options = {}) ⇒ Object



51
52
53
54
55
56
57
58
59
60
# File 'lib/amee/rails.rb', line 51

def has_amee_profile(options = {})
  # Include the instance methods for creation and desctruction
  include InstanceMethods
  # Install callbacks
  before_validation :amee_create, :on => :create
  after_save :amee_save
  before_destroy :amee_destroy
  # Check that this object has an AMEE profile UID when saving
  validates :amee_profile, :presence => true
end