Created
October 12, 2011 17:11
-
-
Save philcrissman/1281853 to your computer and use it in GitHub Desktop.
destroy_all, with conditions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> # on a model, works fine. | |
> Voucher.destroy_all(:user_id => nil) | |
=> # works as expected; returns an array of the records it destroyed, and said records have been deleted. | |
> # on a collection: | |
> wv.voucher_restrictions.destroy_all(:restriction_id => 108) | |
=> ArgumentError: wrong number of arguments (1 for 0) | |
> # but... this works: | |
> wv.voucher_restrictions.where(:restriction_id => 108).destroy_all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment