Thanks for your reply.

The thing is users may or may not know (or remember) the name of the
airport they are looking for.
So the search method needs to narrow down airports from the user inputs
including city names and/or country names.

For example, you wish to travel from JFK New York USA (though it's a
famous airport...), you don't clearly remember the name of the airport.
All you can pull out from your memory is the country and the city, in
this case 'New York' and 'USA'

You enter 'New York USA' in the form, the app narrows down the
possibilities to the airport in 'New York (State) USA'.  Once the list
of possible airports is small, you now may be able to choose the name of
the airport relatively easily.

I hope make myself clearer.

I am looking for something like

    scope :search_by_name, lambda { |name, city, country|
        joins(:name).where("LOWER(name) LIKE ? AND LOWER(city) LIKE ? 
AND LOWER(country) LIKE ?", "%#{params[:name].downcase}%")
    }

I have made this up, surely it won't work :)

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to