So i am trying to do this
Order.find :all, :conditions => "org = 'test org'"
SELECT * FROM `orders` WHERE (org = 'test org')
First turn on the general query log in MySQL and see whether the query, as received and executed by MySQL itself, is correct.
This is because Rails will squeeze all duplicate whitespace from its own query logs (when running in development mode):
# /rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb def log_info(sql, name, ms) if @logger && @logger.debug? name = '%s (%.1fms)' % [name || 'SQL', ms] @logger.debug(format_log_entry(name, sql.squeeze(' '))) end end
If the query sent to MySQL, according to the MySql query log itself, is still incorrect, try again with:
Order.find :all, :conditions => [ 'org = ?', 'test org' ]