in Rails 4.0.4 this code work:
mailboxes = Mailbox.order(:mailbox) mailboxes.keep_if do |mailbox| # test end
in Rails 4.1.0 it break with NoMethodError (undefined method keep_if for <Mailbox::ActiveRecord_Relation:0x5494f80>)
and has to be changed to
mailboxes = Mailbox.order(:mailbox).to_a mailboxes.keep_if do |mailbox| # test end
I don't find any information about that
Any idea?
Its in release notes for rails 4.1
Relation no longer has mutator methods like #map! and #delete_if. Convert to an Array by calling #to_a before using these methods. (Pull Request)
Since keep_if
is a mutator method, its removed from Relation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With