aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-12-30 20:59:27 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-12-30 21:02:46 -0300
commit04852b875ec5c2bd5e5f8bf525b7be60682d0c27 (patch)
tree134de2742be036a222ca0db5de68a2494fa47736 /activerecord/lib
parenta4d5e835608d951cf6c306ccc9aed06896e07c15 (diff)
downloadrails-04852b875ec5c2bd5e5f8bf525b7be60682d0c27.tar.gz
rails-04852b875ec5c2bd5e5f8bf525b7be60682d0c27.tar.bz2
rails-04852b875ec5c2bd5e5f8bf525b7be60682d0c27.zip
Fix error message when trying to create an associated record
This error only happens when the foreign key is missing. Before this fix the following exception was being raised: NoMethodError: undefined method `val' for #<Arel::Nodes::BindParam:0x007fc64d19c218> Now the message is: ActiveRecord::UnknownAttributeError: unknown attribute 'foreign_key' for Model.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/relation.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb
index 2f067d867c..cdafa6a50a 100644
--- a/activerecord/lib/active_record/relation.rb
+++ b/activerecord/lib/active_record/relation.rb
@@ -569,7 +569,7 @@ module ActiveRecord
[name, binds.fetch(name.to_s) {
case where.right
when Array then where.right.map(&:val)
- else
+ when Arel::Nodes::Casted, Arel::Nodes::Quoted
where.right.val
end
}]