lib/restful_query/condition.rb in restful_query-0.4.0 vs lib/restful_query/condition.rb in restful_query-0.5.0
- old
+ new
@@ -1,10 +1,10 @@
module RestfulQuery
class InvalidOperator < Error; end;
class Condition
- attr_reader :column, :value, :operator, :options
+ attr_reader :value, :operator, :options
OPERATOR_MAPPING = {
'lt' => '<',
'gt' => '>',
'gteq' => '>=',
@@ -77,9 +77,13 @@
{column => {map_operator(operator, true) => value}}
end
def to_condition_array
["#{column} #{operator} #{placeholder}", value]
+ end
+
+ def column
+ ActiveRecord::Base.connection.quote_column_name(@column)
end
def placeholder
if ['IN', 'NOT IN'].include?(operator)
'(?)'
\ No newline at end of file