aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Toews <mastahyeti@gmail.com>2017-09-25 10:54:53 -0600
committerMatthew Draper <matthew@trebex.net>2017-11-09 22:37:24 +1030
commit40d302d880f247ef9547708b1d26a390945b6fe9 (patch)
tree19e0c6078906524664d84a7bd59f82750c66c7b8
parent65328025917f0b60d0fbbeca87f173f34d9c91c5 (diff)
downloadrails-40d302d880f247ef9547708b1d26a390945b6fe9.tar.gz
rails-40d302d880f247ef9547708b1d26a390945b6fe9.tar.bz2
rails-40d302d880f247ef9547708b1d26a390945b6fe9.zip
always allow Arel::Attributes::Attribute also
-rw-r--r--activerecord/lib/active_record/attribute_methods.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb
index 5ce3ba7a63..ff381b4e0b 100644
--- a/activerecord/lib/active_record/attribute_methods.rb
+++ b/activerecord/lib/active_record/attribute_methods.rb
@@ -170,7 +170,9 @@ module ActiveRecord
def enforce_raw_sql_whitelist(args, whitelist: attribute_names_and_aliases) # :nodoc:
unexpected = args.reject do |arg|
whitelist.include?(arg.to_s) ||
- arg.kind_of?(Arel::Node) || arg.is_a?(Arel::Nodes::SqlLiteral)
+ arg.kind_of?(Arel::Node) ||
+ arg.is_a?(Arel::Nodes::SqlLiteral) ||
+ arg.is_a?(Arel::Attributes::Attribute)
end
return if unexpected.none?