GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Add unit test to demonstrate issue with similar callback methods overriding each other in distinct contexts
Add unit test to demonstrate issue with similar callback methods over…
…riding each other in distinct contexts
Demonstrates issue in:
Consider the callback context when determining equality
I think this also affects after_commit callbacks. Should we add a test for that, too?
Can we please get this merged in prior to the 3.1 release?
Thanks for the patch with the fix but it does not make sense to hardcode options[:on]. The :on option just makes sense for a few callbacks and does not belong conceptually in AS::Callbacks. I am still unsure on how to properly solve the issue. Maybe we should allow :on to receive an array?
I would be even happier if I could do :on => [ :create, :update ]
:on => [ :create, :update ]
@bgentry that is easier to implement. You just need to rewrite this:
As something like:
Also in a couple other places like:
When determining equality between callbacks, ignore :if, :unless, and…
… :per_key options
@josevalim- I agree that hard coding :on is not appropriate. How about instead of white listing options that imply difference, we black list options that determine equivalence.
@mandrews I believe black listing would work fine. +1
Note: the target of this commit is currently goes to 3.0.6, which is so old. I believe there's no way to change it, so maybe @josevalim can merge it into master instead.
I believe this is a bugfix, so targets are for 3-0-stable, 3-0-9, 3-1-stable and master. And please don't forget the CHANGELOG entry. ;)
I rebased to master, ran the unit tests and created a new pull request:
Closed in favor of #1777
Merge pull request #269 from amatsuda/string_blank
define String#blank? only if not defined yet