Take a look at these search extensions to ActiveRecord.
http://wiki.rubyonrails.com/rails/show/FullTextSearch
http://wiki.rubyonrails.com/rails/show/TextSearch
On Jun 21, 2005, at 1:48 PM, Payam Fard wrote:
> I have another question regarding my many-to-many
> relationship. Resources and Assignments tables have
> many-to-many relationship.
>
> Now, I have a search page that would take values for
> all the fields in assignment and resource tables. What
> I do is to dynamically create the condition part of
> the find depending on what values being populated in
> the search form as follows. Then I do the following:
>
> criteria = ""
>
> if @params[:first_name] != ""
> criteria = criteria + " first_name = ''" +
> @params[:first_name] + "'' "
> end
> ...
>
> Resource.find(:all, :condition => criteria)
>
> Criteria being created as a result includes the fields
> from both tables. When I execute the above code I get
> an error message saying unknown column for every
> single field that exists in the Assignment table.
> Isn''t activerecord supposed to find that there is a
> many-to-many relationship between the two tables and
> find all the assignments associated with each
> resource?
> What can I do to fix it?
>
> Thanks in advance,
> Payam.
>
>
>
>
>
> ____________________________________________________
> Yahoo! Sports
> Rekindle the Rivalries. Sign up for Fantasy Football
> http://football.fantasysports.yahoo.com
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
Duane Johnson
(canadaduane)