Module: AMEE::Rails::InstanceMethods

Defined in:
lib/amee/rails.rb

Instance Method Summary collapse

Instance Method Details

#amee_connectionObject



87
88
89
90
# File 'lib/amee/rails.rb', line 87

def amee_connection
  # Should be overridden by code which doesn't use the global AMEE connection
  AMEE::Rails.connection
end

#amee_createObject



69
70
71
72
73
# File 'lib/amee/rails.rb', line 69

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

#amee_destroyObject



80
81
82
83
84
85
# File 'lib/amee/rails.rb', line 80

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

#amee_saveObject



75
76
77
78
# File 'lib/amee/rails.rb', line 75

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

#save_with_ameeObject



65
66
67
# File 'lib/amee/rails.rb', line 65

def save_with_amee
  save_without_amee && amee_save
end