Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rwdaigle committed Aug 19, 2008
1 parent 78043bc commit cc8cbba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/utility_scopes/ordered.rb
Expand Up @@ -21,7 +21,9 @@ module ClassMethods
def ordered_by(clause = 'created_at DESC')

# Add named scope
named_scope :ordered, lambda { |*order| { :order => order.blank? ? self.default_ordering : order } }
named_scope :ordered, lambda { |*order|
{ :order => order.flatten.first || self.default_ordering }
}

# Give the class it's convenience "orderings" and "default_ordering" accessors
metaclass.instance_eval do
Expand Down

0 comments on commit cc8cbba

Please sign in to comment.