« return

Rails 3 lambda in scope "odd number list for Hash"

15-Oct-2010, Ant

In Rails 3 using lambda in a scope only requires 1 set of curly brackets.

eg.
Rails 2.3.x
named_scope :current_language, lambda { { :conditions => ["posts.language_id = ? ", @language.id] } }

Rails 3
scope :current_language, lambda { where("posts.language_id = ? ", @language.id) }