lib/builder/action_definitions.rb in sinatra_resource-0.2.5 vs lib/builder/action_definitions.rb in sinatra_resource-0.2.6
- old
+ new
@@ -41,11 +41,11 @@
check_permission(:update, role, resource_config)
if resource_config[:parent]
check_related?(parent_document, association, id)
end
check_params(:update, role, resource_config, leaf)
- do_callback(:before_update, resource_config, nil)
+ do_callback(:before_update, resource_config, find_document!(model, id))
document = update_document!(model, id)
do_callback(:after_update, resource_config, document)
document
end
@@ -53,10 +53,10 @@
check_permission(:delete, role, resource_config)
if resource_config[:parent]
check_related?(parent_document, association, id)
end
check_params(:delete, role, resource_config, leaf)
- do_callback(:before_destroy, resource_config, nil)
+ do_callback(:before_destroy, resource_config, find_document!(model, id))
document = delete_document!(model, id)
do_callback(:after_destroy, resource_config, document)
document
end