lib/searchlogic/named_scopes/ordering.rb in joost-searchlogic-2.1.7.1 vs lib/searchlogic/named_scopes/ordering.rb in joost-searchlogic-2.2.3.1
- old
+ new
@@ -7,31 +7,31 @@
end
def primary_condition_name(name) # :nodoc
if result = super
result
- elsif order_condition?(name)
+ elsif ordering_condition?(name)
name.to_sym
else
nil
end
end
- def order_condition?(name) # :nodoc:
- !order_condition_details(name).nil?
- end
-
private
+ def ordering_condition?(name) # :nodoc:
+ !ordering_condition_details(name).nil?
+ end
+
def method_missing(name, *args, &block)
if name == :order
named_scope name, lambda { |scope_name|
- return {} if !order_condition?(scope_name)
+ return {} if !condition?(scope_name)
send(scope_name).proxy_options
}
send(name, *args)
- elsif details = order_condition_details(name)
- create_order_conditions(details[:column])
+ elsif details = ordering_condition_details(name)
+ create_ordering_conditions(details[:column])
send(name, *args)
else
super
end
end
@@ -42,10 +42,10 @@
elsif name.to_s =~ /^order$/
{}
end
end
- def create_order_conditions(column)
+ def create_ordering_conditions(column)
named_scope("ascend_by_#{column}".to_sym, {:order => "#{table_name}.#{column} ASC"})
named_scope("descend_by_#{column}".to_sym, {:order => "#{table_name}.#{column} DESC"})
end
end
end
\ No newline at end of file