module QueryMethodsExtend::OrExtend
Public Instance Methods
build_string_where(where_data)
click to toggle source
# File lib/query_methods_extend/or.rb, line 25 def build_string_where where_data where_data.map{ |data| data.class == String ? data : data.to_sql }.join(' AND ') end
set_is_query_or(value)
click to toggle source
# File lib/query_methods_extend/or.rb, line 5 def set_is_query_or value @is_query_or = value if self.where_values.size > 0 self end
where!(opts, *rest)
click to toggle source
# File lib/query_methods_extend/or.rb, line 10 def where!(opts, *rest) if Hash === opts opts = sanitize_forbidden_attributes(opts) references!(ActiveRecord::PredicateBuilder.references(opts)) end if @is_query_or set_is_query_or false self.where_values = ["(#{build_string_where(self.where_values)}) OR (#{build_string_where(build_where(opts, rest))})"] else self.where_values += build_where(opts, rest) end self end