removing fake sanitize methods in specs because we're using Active Record now
This commit is contained in:
parent
8628aa0038
commit
e8d298c223
|
@ -30,28 +30,4 @@ end
|
||||||
|
|
||||||
class Project < SuperModel::Base
|
class Project < SuperModel::Base
|
||||||
belongs_to :category
|
belongs_to :category
|
||||||
|
|
||||||
class << self
|
|
||||||
protected
|
|
||||||
|
|
||||||
def sanitize_sql(hash_cond)
|
|
||||||
case hash_cond
|
|
||||||
when Hash
|
|
||||||
sanitize_hash(hash_cond).join(' AND ')
|
|
||||||
when Array
|
|
||||||
hash_cond.shift.gsub('?'){"#{hash_cond.shift.inspect}"}
|
|
||||||
when String then hash_cond
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def sanitize_hash(hash)
|
|
||||||
hash.map do |name, value|
|
|
||||||
if Hash === value
|
|
||||||
sanitize_hash(value).map{|cond| "#{name}.#{cond}"}
|
|
||||||
else
|
|
||||||
"#{name}=#{value}"
|
|
||||||
end
|
|
||||||
end.flatten
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user