Module: ActiveRecordToSimpledb::Callbacks::Create
- Defined in:
- lib/active_record_to_simpledb.rb
Class Method Summary collapse
-
.included(base) ⇒ Object
Private: some meta programing to create a callback in the model class.
Instance Method Summary collapse
- #domain_name ⇒ Object
-
#send_object_to_simpledb ⇒ Object
Private: it create a resque job in we are not in test.
Class Method Details
.included(base) ⇒ Object
Private: some meta programing to create a callback in the model class.
115 116 117 118 119 |
# File 'lib/active_record_to_simpledb.rb', line 115 def self.included(base) base.class_eval do after_create :send_object_to_simpledb end end |
Instance Method Details
#domain_name ⇒ Object
96 97 98 |
# File 'lib/active_record_to_simpledb.rb', line 96 def domain_name self.class.to_s.downcase end |
#send_object_to_simpledb ⇒ Object
Private: it create a resque job in we are not in test. Otherwise, it create the simpledb object
102 103 104 105 106 107 108 109 110 |
# File 'lib/active_record_to_simpledb.rb', line 102 def send_object_to_simpledb if RAILS_ENV == "test" # we do nothing in the test env because we don't want to polute other people tests elsif RAILS_ENV == "prueba" ActiveRecordToSimpledb::Client.create(domain_name, self.attributes) else Resque.enqueue(ActiveRecordToSimpledb::JobQueue::Create, self.class.name, domain_name , self.id) end end |