method
symbol_unscoping
rails latest stable - Class:
ActiveRecord::QueryMethods
symbol_unscoping(scope)private
No documentation available.
# File activerecord/lib/active_record/relation/query_methods.rb, line 988
def symbol_unscoping(scope)
if !VALID_UNSCOPING_VALUES.include?(scope)
raise ArgumentError, "Called unscope() with invalid unscoping argument ':#{scope}'. Valid arguments are :#{VALID_UNSCOPING_VALUES.to_a.join(", :")}."
end
clause_method = Relation::CLAUSE_METHODS.include?(scope)
multi_val_method = Relation::MULTI_VALUE_METHODS.include?(scope)
if clause_method
unscope_code = "#{scope}_clause="
else
unscope_code = "#{scope}_value#{'s' if multi_val_method}="
end
case scope
when :order
result = []
else
result = [] if multi_val_method
end
self.send(unscope_code, result)
end