rails/rails — Issue #5313: Receiving Deprecation Warnings for saying declared attributes are arbitrary attributes
Author: jklina
Created: 2012-03-07 04:20:47+00:00
State: open

Will this work and/or should this work if you specify a custom foreign key in a model's relationship?

For example:
`belongs_to :department_approver, :class_name => "User", :foreign_key => "dept_approved_purchase_request_id"`

In the console I did the following:

`
ruby-1.9.2-p290 :005 > p.department_approver = User.first
User Load (0.2ms) SELECT "users".* FROM "users" LIMIT 1
=> #
ruby-1.9.2-p290 :006 > p.department_approver
=> #
ruby-1.9.2-p290 :007 > p[:department_approver]
=> nil
ruby-1.9.2-p290 :008 > p.id
=> 273
ruby-1.9.2-p290 :009 > p[:id]
=> 273
ruby-1.9.2-p290 :014 > p[:department_approver] = User.first
User Load (0.4ms) SELECT "users".* FROM "users" LIMIT 1
ActiveModel::MissingAttributeError: can't write unknown attribute `department_approver'
`