I'm having trouble trying to implement a basic keyword search in my
app. I'm trying to search through multiple tables. I m using a vendor
plugin for the conditions(which should not effect the search).
The association in the models is as following
The furni model contains this association to the raider model:
So what I'm trying to do is to have the search go through the raiders
table as well. I do not know if it's possible. I tried joins with no
luck. Hope some one can give me a pointer. Thanks
may work, if your method returns a simple conditions string.
If it returns the conditions in Array or Hash form, you may have to
merge it with the additional conditions for raiders.
may work, if your method returns a simple conditions string.
If it returns the conditions in Array or Hash form, you may have to
merge it with the additional conditions for raiders.
Thanx for your help, but it does not work. The conditions_by_like
function is a vendor plug in and it performs a generic search(below). I
do not know what I'm doing wrong.
def conditions_by_like(value, *columns)
columns = self.user_columns if columns.size==0
columns = columns[0] if columns[0].kind_of?(Array)
conditions = columns.map {|c|
c = c.name if c.kind_of?
ActiveRecord::ConnectionAdapters::Column
"`#{c}` LIKE " +
ActiveRecord::Base.connection.quote("%#{value}%")
}.join(" OR ")
end