I am building an app where I'd like to use a simple search to search through the object's title, AND tags (using acts_as_taggable_on) in one search
I am able to construct either, but not both, and am at my wits end trying to figure it out.
To search using tags, I use:
@post = Post.tagged_with(params[:search])
To search the object, I use:
@post = Post.search(params[:search])
And I wrote a method called search in the Post model, as follows:
def self.search(search)
if search
where('question LIKE ?', "%#{search}%")
else
scoped
end
end
Any idea how to combine these two queries? Any attempts so far have been unsuccessful mainly because there isn't a "tag" column in my Post model, etc.