I have a Search Model which contains search data. It looks like this:

keywords:string
by_user:boolean
by_title:boolean
...

So basically what I want is, if one of the booleans is true it will
search that particular index. So if by_user is true and by_title is
true, it will search the database of stories by user and title. If
only by_user is true, then it will only search by user.

So here's what I'm planning in the Search Model:

def stories
find_stories
end

def find_stories
find(:all, :conditions => ??)
end

I'm confused has to how to make the conditions since it will have to
check which booleans are true and then append onto the conditions. How
would I do this?
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to