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