Skip to content
Snippets Groups Projects
Commit b2ae9f1d authored by Alex Reisner's avatar Alex Reisner
Browse files

Allow setting :order => nil to omit ORDER clause.

parent f02ecbae
No related branches found
No related tags found
No related merge requests found
......@@ -111,10 +111,11 @@ module Geocoder::Store
else
conditions = ["#{distance} <= ?", radius]
end
default_near_scope_options(latitude, longitude, radius, options).merge(
{
:select => select_clause(options[:select], distance, bearing),
:conditions => add_exclude_condition(conditions, options[:exclude])
)
:conditions => add_exclude_condition(conditions, options[:exclude]),
:order => options.include?(:order) ? options[:order] : "distance ASC"
}
end
def distance_from_sql_options(latitude, longitude, options = {})
......@@ -157,17 +158,6 @@ module Geocoder::Store
(bearing ? ", #{bearing} AS bearing" : "")
end
##
# Options used for any near-like scope.
#
def default_near_scope_options(latitude, longitude, radius, options)
{
:order => options[:order] || "distance",
:limit => options[:limit],
:offset => options[:offset]
}
end
##
# Adds a condition to exclude a given object by ID.
# Expects conditions as an array or string. Returns array.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment