rails 3.2.11
I have models
Airport
:name, :string
belongs_to city
City
:name, :string
has_many airports
belongs_to country
Country
:name, :string
has_many cities
and I want to search a particular airport through this association
scope :search_airport, where(:name => name, :city => city, :country =>
country)
clearly this does not work
Could anyone show me how to set up a scope through association?
the input maybe only airport name, or airport name with city, or airport
name with city and country name.
soichi
--
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+unsubscribe@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.
No comments:
Post a Comment