I''m doing a ferret find_by_contents search which searches multiple tables. One of the conditions i''m putting through is a test on a column that some of the tables don''t have, which is making the test crash. To be specific, i''m searching on Lesson, Course and Resource, and one of the conditions relates to a field ''kind_id'', which is only possessed by the ''resources'' table. To get around this, i put in another test first, on a ''type'' field, which is set to ''Resource'' for all rows in the ''Resource'' table. I thought that this would mean that kind_id was only tested on rows from the resources table, but it''s not working - the test still fails as kind_id is being evaluated against tables that don''t have the field. My value for the conditions key is conditions << "type = \''Resource\'' AND kind_id IN (#{params[:kinds].collect{|k| k.to_s}.join(",")})" which evaluates to something like conditions << "type = \''Resource\'' AND kind_id IN ("1","4","8")" So, basically i need the SQL test to be lazy, and not evaluate kind_id if the first test fails. Is this possible? If not, can anyone see a different way around this? For example, can i only test the kind_id conditions on rows from a specific table? thanks, max -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---