Module: CreateUpdateDestroyAsync::ActiveRecordExt
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/create_update_destroy_async/active_record_ext.rb
Instance Method Summary collapse
Instance Method Details
#destroy_async ⇒ Object
22 23 24 |
# File 'lib/create_update_destroy_async/active_record_ext.rb', line 22 def destroy_async CreateUpdateDestroyAsync::Jobs::Destroy.perform_later(self) end |
#save_async ⇒ Object
11 12 13 14 15 16 |
# File 'lib/create_update_destroy_async/active_record_ext.rb', line 11 def save_async new_attributes = changes.each_with_object({}) do |(k, v), hash| hash[k] = v[1] end CreateUpdateDestroyAsync::Jobs::Save.perform_later(self, new_attributes) end |
#update_async(new_attributes = {}) ⇒ Object
18 19 20 |
# File 'lib/create_update_destroy_async/active_record_ext.rb', line 18 def update_async(new_attributes = {}) CreateUpdateDestroyAsync::Jobs::Update.perform_later(self, changed_attributes.merge(new_attributes)) end |