lib/geokit-rails/acts_as_mappable.rb
# Prepares either a find or a count action by parsing through the options and
# conditionally adding to the select clause for finders.
Prepares either a find or a count action by parsing through the options and
conditionally adding to the select clause for finders.
Prepares either a find or a count action by parsing through the options and conditionally adding to the select clause for finders .
def prepare_for_find_or_count(action, args)
        options = args.extract_options!
        origin = extract_origin_from_options(options)
        units = extract_units_from_options(options)
        formula = extract_formula_from_options(options)
        bounds = extract_bounds_from_options(options)
        if origin || bounds
          bounds = formulate_bounds_from_distance(options, origin, units) unless bounds
          add_distance_to_select(options, origin, units, formula) if origin && action == :find
          apply_bounds_conditions(options,bounds) if bounds
          apply_distance_scope(options)
          substitute_distance_in_conditions(options, origin, units, formula) if origin && options.has_key?(:conditions)
          apply_find_scope(args, options) if action == :find
          apply_include_for_through(options)
          handle_order_with_include(options,origin,units,formula) if options.include?(:include) && options.include?(:order) && origin
        end
        args.push(options)
      end
def prepare_for_find_or_count ( action , args ) options = args . extract_options! origin = extract_origin_from_options ( options ) units = extract_units_from_options ( options ) formula = extract_formula_from_options ( options ) bounds = extract_bounds_from_options ( options ) if origin || bounds bounds = formulate_bounds_from_distance ( options , origin , units ) unless bounds add_distance_to_select ( options , origin , units , formula ) if origin && action == :find apply_bounds_conditions ( options , bounds ) if bounds apply_distance_scope ( options ) substitute_distance_in_conditions ( options , origin , units , formula ) if origin && options . has_key? ( :conditions ) apply_find_scope ( args , options ) if action == :find apply_include_for_through ( options ) handle_order_with_include ( options , origin , units , formula ) if options . include? ( :include ) && options . include? ( :order ) && origin end args . push ( options ) end
Prepares either a find or a count action by parsing through the options and
conditionally adding to the select clause for finders.
Prepares either a find or a count action by parsing through the options and conditionally adding to the select clause for finders .
#options = defined?(args.extract_options!) ? args.extract_options! : extract_options_from_args!(args) # Obtain items affecting distance condition. # Only proceed if this is a geokit-related query # if no explicit bounds were given, try formulating them from the point and distance given # Apply select adjustments based upon action. # Apply the conditions for a bounding rectangle if applicable # Apply distance scoping and perform substitutions. # Order by scoping for find action. # Handle :through # Unfortunatley, we need to do extra work if you use an :include. See the method for more info. # Restore options minus the extra options that we used for the # Geokit API.
action
<not_specific>
args
<not_specific>