Ruby on Rails Monday, November 1, 2010

Michael Pavling wrote in post #958364:
> On 31 October 2010 20:05, MDM <don.mapp@gmail.com> wrote:
>> Both of these works which do you think is best.
>> self.where('section LIKE ?', "%#{search_item}%")
>> self.where('section LIKE ?', '%'+search_item+'%')
>
> personally, I prefer the syntax of the first method; it seems more
> "Ruby".

It also performs slightly better, since it doesn't create extra String
objects.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org

--
Posted via http://www.ruby-forum.com/.

--
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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment