lib/scoped_search/definition.rb in scoped_search-2.7.0 vs lib/scoped_search/definition.rb in scoped_search-2.7.1
- old
+ new
@@ -137,9 +137,15 @@
return nil if options[:default_order].nil?
field_name = options[:rename].nil? ? options[:on] : options[:rename]
order = (options[:default_order].to_s.downcase.include?('desc')) ? "DESC" : "ASC"
return "#{field_name} #{order}"
end
+
+ # Return 'table'.'column' with the correct database quotes
+ def quoted_field
+ c = klass.connection
+ "#{c.quote_table_name(klass.table_name)}.#{c.quote_column_name(field)}"
+ end
end
attr_reader :klass
# Initializes a ScopedSearch definition instance.