From 04852b875ec5c2bd5e5f8bf525b7be60682d0c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Tue, 30 Dec 2014 20:59:27 -0300 Subject: 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 # Now the message is: ActiveRecord::UnknownAttributeError: unknown attribute 'foreign_key' for Model. --- activerecord/lib/active_record/relation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') 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 }] -- cgit v1.2.3