belongs_to with a :foreign_key incorrectly uses it for form fields
Reported by Kieran P | March 2nd, 2010 @ 02:43 AM
Consider the following on any model:
fields do
manager_id :integer
end
belongs_to :manager, :class_name => "User", :foreign_key => :id
Basically, when I call .manager, it gets the user, and that works.
But is incorrectly setting the name of the manager field to the forgien key
<select class="manager-tag user project-manager input belongs_to project_manager" name="project[id]">
...
</select>
Not the name="". It's setting project[id], rather than project[manager_id], which causes validations to fail.
If I remove the foreign key, the .manager call then fails.
Comments and changes to this ticket
-
Matt Jones March 3rd, 2010 @ 02:47 AM
- State changed from new to invalid
This is very likely triggered by the problem in #648. Please leave a note if handling that doesn't solve this problem.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป