Re: [Rails] create conditions in model
On Sun, Dec 2, 2012 at 4:26 PM, Jean <josorioe@gmail.com> 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 ?', "%#{place}%"]
> : conditions << []
> !place.blank? ? conditions << [' AND date LIKE ?', "%#{place}%"] :
> conditions << []
I really like the way Fred puts it together by joining the fragments
into the where clause.
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home