Re: [Rails] create conditions in model

2012-12-03 Thread Jim Ruther Nill
On Tue, Dec 4, 2012 at 11:46 AM, Jim Ruther Nill wrote: > > > > On Mon, Dec 3, 2012 at 6:26 AM, Jean wrote: > >> Hello guys, >> >> I trying to create the conditions of my search, but I have some troubles. >> >> This is the method I'm trying to create in my model. >> >> def self.searchadv(title,

Re: [Rails] create conditions in model

2012-12-03 Thread Jim Ruther Nill
On Mon, Dec 3, 2012 at 6:26 AM, Jean wrote: > Hello guys, > > I trying to create the conditions of my search, but I have some troubles. > > This is the method I'm trying to create in my model. > > def self.searchadv(title, place, category, date) > !title.blank? ? conditions = ['title LIKE ?',

Re: [Rails] create conditions in model

2012-12-03 Thread tamouse mailing lists
On Sun, Dec 2, 2012 at 4:26 PM, Jean wrote: > def self.searchadv(title, place, category, date) Colour me doubtful, but since you're passing in category and date, why are you using place in your category and date subclauses? > !place.blank? ? conditions << [' AND category LIKE ?', "%#{pla

[Rails] create conditions in model

2012-12-02 Thread Jean
Hello guys, I trying to create the conditions of my search, but I have some troubles. This is the method I'm trying to create in my model. def self.searchadv(title, place, category, date) !title.blank? ? conditions = ['title LIKE ?', "%#{title}%"] : conditions = [] if conditions