Module: AMEE::Rails::ClassMethods

Defined in:
lib/amee/rails.rb

Instance Method Summary collapse

Instance Method Details

#has_amee_profile(options = {}) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/amee/rails.rb', line 35

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