In Rails 4.1 ActiveRecord relation objects removes mutator methods.

# Release note
# Relation no longer has mutator methods like #map! and #delete_if. Convert to an Array by calling #to_a before using these methods.

# Rails 4.0
>> User.all.order('id DESC').map {|u| u } 
=> [#> User.all.order('id DESC').map {|u| u }
=> undefined method `map' for #> User.all.order('id DESC').to_a.map {|u| u } 
=> [#

🙂

Comments

    • Richard February 19, 2014
    • Reply

    map itself is not a mutator method as it doesn’t change the collection, so this is not necessary.

Leave a Reply

Screen Shot 2013-12-08 at 9.49.35 PM

I have helped a dozen companies build and optimize their engineering teams to deliver great products.

Let’s work together and I can align your business needs with your technology initiatives.