Skip to content

Adding support to cancel "restore" and "real_destroy" actions#283

Open
arieliten wants to merge 1 commit intorubysherpas:rails4from
arieliten:rails4
Open

Adding support to cancel "restore" and "real_destroy" actions#283
arieliten wants to merge 1 commit intorubysherpas:rails4from
arieliten:rails4

Conversation

@arieliten
Copy link
Copy Markdown

Currently the callbacks for before_restore and before_real_destroy can't be canceled (via returning false) like any other normal ActiveModel::Callback. So here I'm adding the support to cancel any of those actions (restore or real_destroy) by returning false in their callbacks.

@rbr
Copy link
Copy Markdown
Contributor

rbr commented Feb 22, 2016

Canceling callbacks with falseseems to be deprecated in Rails 5: rails/rails#17227, throw(:abort) is the new way.

@valentindruon
Copy link
Copy Markdown

What if we are not using Rails 5.0?

@therrick
Copy link
Copy Markdown

I'd love to see this get merged. We've been using a custom fork with this change for several months now and would much rather have it in the main repo. Any outlook for accepting it?

@BenMorganIO
Copy link
Copy Markdown
Collaborator

BenMorganIO commented Jul 12, 2016

Good job @arieliten. Can you provide a test for this change?

@kasparsj
Copy link
Copy Markdown

kasparsj commented Nov 9, 2016

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants