No need to check if the attribute exists (this is the same behavior as in 2.3) [#4994 state:resolved] and [#5003 state:resolved]

This commit is contained in:
José Valim
2010-06-29 20:15:29 +02:00
parent 67582f08bf
commit af6ec607fa

View File

@@ -20,9 +20,7 @@ module ActiveRecord
table = Arel::Table.new(table_name, :engine => @engine)
end
unless attribute = table[column]
raise StatementInvalid, "No attribute named `#{column}` exists for table `#{table.name}`"
end
attribute = table[column] || Arel::Attribute.new(table, column)
case value
when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::Relation