I have a table containing 2 "unusual" columns - order and like .
The table is replicated in two databases - MySQL and PostgreSQL .
And I need the same application to connect to both databases and use the same query for both:
PageModel.where("`like` >= ?", params[:liked])
This will only work in MySQL .
How to make ActiveRecord to specify a column name?
Something like:
PageModel.where("%s >= ?" % quote_column_name(:like), params[:liked])
I found a method that is useless right now - it just returns the column name without a quote.
http://www.rubydoc.info/docs/rails/3.2.8/ActiveRecord/ConnectionAdapters/Quoting:quote_column_name
Perhaps this is just a placeholder, and is there another way that does this?
user904990
source share