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_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