Module: AMEE::Rails::InstanceMethods

Defined in:
lib/amee/rails.rb

Instance Method Summary collapse

Instance Method Details

#amee_connectionObject



52
53
54
55
# File 'lib/amee/rails.rb', line 52

def amee_connection
  # Should be overridden by code which doesn't use the global AMEE connection
  $amee
end

#amee_createObject



34
35
36
37
38
# File 'lib/amee/rails.rb', line 34

def amee_create
  # Create profile
  profile = AMEE::Profile::Profile.create(amee_connection)
  self.amee_profile = profile.uid
end

#amee_destroyObject



45
46
47
48
49
50
# File 'lib/amee/rails.rb', line 45

def amee_destroy
  # Delete profile
  AMEE::Profile::Profile.delete(amee_connection, amee_profile)
rescue
  puts "Couldn't remove profile #{amee_profile}"
end

#amee_saveObject



40
41
42
43
# File 'lib/amee/rails.rb', line 40

def amee_save
  # This is only here to be overridden
  return true
end

#save_with_ameeObject



30
31
32
# File 'lib/amee/rails.rb', line 30

def save_with_amee
  save_without_amee && amee_save
end