Never had this issue before updating to Rails 2.1.0. Now for some reason
the condition clause used with an array is not working. I’ve been trying
use work arounds but I can’t figure it out. Please anyone HELP!!!
Query in question.
@furnii_from_furnii = Furni.find(:all, :include => [:raider],
:conditions => “”+Furni.conditions_by_like(@search)+" OR "
+Raider.conditions_by_like(@search)+"")
I do not understand why do you want conditions_by_like kind of
functions,
but anyways.
A very crude way(which I hate):
@furnii_from_furnii = Furni.find(:all, :include => [:raider],
:conditions => “#{Furni.conditions_by_like(@search)} OR
#{Raider.conditions_by_like(@search)}”)
You can check the implementation of these methods as well:
Furni.conditions_by_like(@search)
Raider.conditions_by_like(@search)
Gourav
On Aug 12, 3:44 pm, Sam G. [email protected]
Gourav T. wrote:
I do not understand why do you want conditions_by_like kind of
functions,
but anyways.
A very crude way(which I hate):
@furnii_from_furnii = Furni.find(:all, :include => [:raider],
:conditions => “#{Furni.conditions_by_like(@search)} OR
#{Raider.conditions_by_like(@search)}”)
You can check the implementation of these methods as well:
Furni.conditions_by_like(@search)
Raider.conditions_by_like(@search)
Gourav
On Aug 12, 3:44 pm, Sam G. [email protected]
Thanks. The problem was different. in Rails 2.1.0 you have to specify
the table name when you do an eager loading. In regards to why I’m using
a condition_by_like function is that I’m doing a small search where I do
not need ferret or sphinx implementation. The condition_by_like allows
me to loop through columns in tables and also split the search word. So
there you have it. If you have a better way please let me know. I’m
interested in all options.