diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-12-30 20:59:27 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-12-30 21:02:46 -0300 |
commit | 04852b875ec5c2bd5e5f8bf525b7be60682d0c27 (patch) | |
tree | 134de2742be036a222ca0db5de68a2494fa47736 /activerecord/test/models | |
parent | a4d5e835608d951cf6c306ccc9aed06896e07c15 (diff) | |
download | rails-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/test/models')
-rw-r--r-- | activerecord/test/models/company.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index 42f7fb4680..5a56616eb9 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -72,6 +72,7 @@ class Firm < Company # Oracle tests were failing because of that as the second fixture was selected has_one :account_using_primary_key, -> { order('id') }, :primary_key => "firm_id", :class_name => "Account" has_one :account_using_foreign_and_primary_keys, :foreign_key => "firm_name", :primary_key => "name", :class_name => "Account" + has_one :account_with_inexistent_foreign_key, class_name: 'Account', foreign_key: "inexistent" has_one :deletable_account, :foreign_key => "firm_id", :class_name => "Account", :dependent => :delete has_one :account_limit_500_with_hash_conditions, -> { where :credit_limit => 500 }, :foreign_key => "firm_id", :class_name => "Account" |