Leonel *.* wrote:
> pepe wrote:
>> I believe I ran into something similar once some time ago. I think
>> that if you enclose the column name with quotes it might take it.
> 
> Well, actually, it has to be enclosed with ticks and then with single or 
> double quotes, like this...
> 
> default_scope :order => '`when`'
> 
> or
> 
> default_scope :order => "`when`"

Actually, it's a better idea to use quote_column_name instead of literal 
quotes.  This way, changing databases won't break your code (MySQL and 
SQLite use `` identifier quoting, PostgreSQL uses "" or nothing, MS SQL 
uses [], but the quote_column_name method abstracts them all).

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
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].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to