Skip to content

Commit

Permalink
corrected lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
moskyt committed Jan 9, 2010
1 parent 6f4399c commit 4edd6f9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/globalize/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ def translates(*attr_names)
end

self.translated_attribute_names.each do |key|
join = :"#{self.name.underscore}_translations_#{I18n.locale}"
field = "#{self.name.underscore}_translations.#{key}"
self.named_scope :"ascend_by_#{key}", lambda{ { :order => "#{field} ASC", :joins => join } }
self.named_scope :"descend_by_#{key}", lambda{ { :order => "#{field} DESC", :joins => join } }
self.named_scope :"ascend_by_#{key}", lambda{ { :order => "#{field} ASC", :joins => :"#{self.name.underscore}_translations_#{I18n.locale}" } }
self.named_scope :"descend_by_#{key}", lambda{ { :order => "#{field} DESC", :joins => :"#{self.name.underscore}_translations_#{I18n.locale}" } }
end
end

Expand Down

0 comments on commit 4edd6f9

Please sign in to comment.