lib/sn_foil/contexts/destroy_context.rb in snfoil-0.8.0 vs lib/sn_foil/contexts/destroy_context.rb in snfoil-0.8.1
- old
+ new
@@ -15,10 +15,11 @@
end
class_methods do
attr_reader :i_setup_destroy_hooks, :i_before_destroy_hooks, :i_after_destroy_hooks,
:i_after_destroy_success_hooks, :i_after_destroy_failure_hooks
+
def destroy(id:, entity: nil, **options)
new(entity).destroy(**options, id: id)
end
def setup_destroy(method = nil, **options, &block)
@@ -60,10 +61,10 @@
def destroy(**options)
options[:action] = :destroy
options = before_setup_destroy_object(**options)
options = setup_destroy_object(**options)
- authorize(options[:object], options.fetch(:authorize) { :destroy? }, **options)
+ authorize(options[:object], options.fetch(:authorize, :destroy?), **options)
options = destroy_hooks(**options)
options[:object]
end
def setup_destroy(**options)