OH, is there a way to do the REMOVE sql command using the finders so I would
not have to loop over the whole set and replace items?

On Sun, Dec 19, 2010 at 21:16, Chris Habgood <[email protected]> wrote:

> Oh ok, that is cool, thanks.
>
>
> On Sun, Dec 19, 2010 at 21:09, Luke Cowell <[email protected]> wrote:
>
>> Hi Chris, you could try something like this:
>> categories = Category.select("*, LOWER(name) as lower_name")
>>
>> The calculated column 'lower_name' would now be available as a accessor on
>> each result. eg. categories.first.lower_name
>>
>> Luke
>>
>> On 2010-12-19, at 6:42 PM, Chris Habgood wrote:
>>
>> It is, how do I implement it with the Rails 3 finders?
>>
>> On Sun, Dec 19, 2010 at 20:35, Marnen Laibow-Koser 
>> <[email protected]>wrote:
>>
>>> Luke Cowell wrote in post #969470:
>>> > This filters out rows where name is null and orders by name in SQL:
>>> > Category.where("name NOT NULL").order("name ASC")
>>> >
>>> > I'm not sure how to get mysql to downcase the column, but I'm pretty
>>> > sure there's a way.
>>>
>>> I believe the standard SQL function for that is lower().  Check the
>>> docs.
>>> >
>>> > Luke
>>>
>>> Best,
>>> --
>>> Marnen Laibow-Koser
>>> http://www.marnen.org
>>> [email protected]
>>>
>>> Sent from my iPhone
>>>
>>> --
>>> 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 [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<rubyonrails-talk%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>>
>>>
>>
>> --
>> 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.
>>
>>
>>  --
>> 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]<rubyonrails-talk%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>

-- 
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