Index: Rakefile =================================================================== --- Rakefile (revision 312) +++ Rakefile (working copy) @@ -23,6 +23,10 @@ rescue LoadError end +Rake::TestTask.new('test') do |t| + t.pattern = 'test/*_test.rb' +end + desc 'Default: run unit tests.' task :default => :test Index: lib/ambition/processor.rb =================================================================== --- lib/ambition/processor.rb (revision 312) +++ lib/ambition/processor.rb (working copy) @@ -6,6 +6,7 @@ attr_reader :key, :join_string, :prefix, :includes + delegate :quote_column_name, :to => :connection def initialize super() @@ -52,6 +53,10 @@ else ActiveRecord::Base.connection.quote(value) rescue quote(value) end end + + def quote_column_name(value) + ActiveRecord::Base.connection.quote_column_name(value) rescue "`#{value}`" + end def extract_includes(receiver, method) return unless receiver.first == :call && receiver[1].last == @receiver Index: lib/ambition/where.rb =================================================================== --- lib/ambition/where.rb (revision 312) +++ lib/ambition/where.rb (working copy) @@ -135,7 +135,7 @@ when '!~' "#{process(receiver)} NOT LIKE #{process(other)}" else - extract_includes(receiver, method) || "#{process(receiver)}.`#{method}` #{process(other)}" + extract_includes(receiver, method) || "#{process(receiver)}.#{quote_column_name(method)} #{process(other)}" end end end