Module: AMEE::Rails::ClassMethods

Defined in:
lib/amee/rails.rb

Instance Method Summary collapse

Instance Method Details

#has_amee_profile(options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/amee/rails.rb', line 16

def has_amee_profile(options = {})
  # Include the instance methods for creation and desctruction
  include InstanceMethods
  # Install callbacks
  before_validation_on_create :amee_create
  alias_method_chain :save, :amee
  before_destroy :amee_destroy
  # Check that this object has an AMEE profile UID when saving
  validates_presence_of :amee_profile        
end