Module: ActiveManageable::Methods::Destroy
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_manageable/methods/destroy.rb
Instance Method Summary collapse
Instance Method Details
#destroy(id:, options: {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/active_manageable/methods/destroy.rb', line 10 def destroy(id:, options: {}) initialize_state(options: ) @target = action_scope includes(@options[:includes]) @target = find_object_for_destroy(id: id) (record: @target) model_class.transaction do yield if block_given? destroy_object rescue ActiveRecord::RecordNotDestroyed false end end |