You can't, it's a class method, you can create a field search helper which
sends two values for near or zippostal in a hash, so you have both in your
condition_for_<column>_column method.
Another hack would be create a condition_for_zippostal_column, save value in
Thread.current variable and return its conditions. But zippostal column must
be in field search columns before near column.
El domingo, 1 de octubre de 2017 23:07:34 (CEST) Gloufy escribió:
> Hi,
>
> I would like find how to do that :
>
> def self.condition_for_near_column(column, value, like_pattern)
>
> if value!=""
>
> distance = value
>
> if params[:search][:zippostal]!=""
>
> center_point = Geocoder.coordinates(params[:search][:zippostal
> ].to_s+", FRANCE")
>
>
> else
>
> center_point = Geocoder.coordinates("75000, FRANCE")
>
>
> end
>
>
> box = Geocoder::Calculations.bounding_box(center_point, distance)
>
>
>
> ["latitude BETWEEN "+box[0].to_s+" AND "+box[2].to_s+" AND
> longitude BETWEEN "+box[1].to_s+" AND "+box[3].to_s]
>
> end
>
> end
>
>
>
> but I have :
>
>
> NameError (undefined local variable or method `params' for
> Filemaker::PersController:Class):
>
>
>
> app/controllers/test.rb:1094:in `condition_for_near_column'
>
>
>
>
> Do you know how I can do that ?
>
>
> Thank again for your help
>
>
> Gloufy
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/d/optout.