-
-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Allow custom destroy methods. #1818
Conversation
Code Climate has analyzed commit fc7b7d0 and detected 0 issues on this pull request. View more on Code Climate. |
Could this be achieved by overriding the class UsersController
...
def destroy_model
perform_action_and_record_errors do
@model.destroy!
end
end
end In that case, I would merge a PR where we would extract that method so we don't have to wrap it in the class UsersController
def destroy_model
perform_action_and_record_errors do
destroy_record_action
end
end
def destroy_record_action
@model.destroy!
end
end Same with |
@adrianthedev yes, perfect. Now, customizing the delete method is as simple as:
Is that what you had in mind? |
What's the preferred naming convention in this case where we are straddling naming conventions for the model and the resource? Within
|
So, in the begining we used Let's use |
Since the existing For the new methods, we shouldn't have conflict with existing implementations. But for forward compatibility looking ahead to v3, would it make sense to keep 'resource' in the names so that overrides of the method could carry forward without change? Or do you prefer a consistent use of 'model' throughout v2? Lemme know and I'll make it so. |
Yes. I would prefer to use model in v2.
|
Thank you for the contribution. I'll cut a release in a few hours as I have another PR almost ready. |
Description
This is a proposed feature to add custom destroy methods to resources. This makes Avo compatible with soft delete gems like discard. Please reject if not appropriate.
If not defined, the default destroy! is used.
Checklist:
Manual reviewer: please leave a comment with output from the test if that's the case.