Hi folks,
Bit confused by rails and the active record stuff for searching across
tables.
Say I have a property which has an address and I want to search to
provide a form that takes one item and searches across both the address
and property tables… how do I go about it?
Thanks in advance
Marty
I read your question twice and still have no idea what you are trying to
do :). Perhaps if you made it a little clearer we can help.
Cheers, -Jonny.
On 2/15/06, Marty H. [email protected] wrote:
Hi folks,
Bit confused by rails and the active record stuff for searching across
tables.
Say I have a property which has an address and I want to search to
provide a form that takes one item and searches across both the address
and property tables… how do I go about it?
Does this help?
http://rails.techno-weenie.net/question/2006/1/13/how_to_create_searches_across_multiple_fields_using_various_search_criteria
Julian ‘Julik’ Tarkhanov wrote:
On 15-feb-2006, at 16:49, Marty H. wrote:
Hi folks,
Bit confused by rails and the active record stuff for searching across
tables.
Say I have a property which has an address and I want to search to
provide a form that takes one item and searches across both the
address
and property tables… how do I go about it?
If you have many models with the same attribute (and you want to
search across these models but in this attribute only)
[Person, Company].inject([]) do | result, class |
result += class.find_all_by_address(address_query)
end
cheers for the help folks.
did it just using sql for simplicity…
On 15-feb-2006, at 16:49, Marty H. wrote:
Hi folks,
Bit confused by rails and the active record stuff for searching across
tables.
Say I have a property which has an address and I want to search to
provide a form that takes one item and searches across both the
address
and property tables… how do I go about it?
If you have many models with the same attribute (and you want to
search across these models but in this attribute only)
[Person, Company].inject([]) do | result, class |
result += class.find_all_by_address(address_query)
end