This project is archived and is in readonly mode.

#765 ✓committed
Shawn

PATCH: primary_key option for belongs_to

Reported by Shawn | August 6th, 2008 @ 04:40 PM | in 2.3.6

Could some one add :primary_key option into belongs_to in a similar fashion like ticket 292? This option is a nice-to-have for has_many, because you can always use finder_sql to workaround it. But it is a must-to-have for belongs_to because there is no way to wrok around it. I had a quick look at the source code and added

def owner_quoted_id

if @reflection.options:primary_key]

quote_value(@owner.send @reflection.options:primary_key]))

else

@owner.quoted_id

end

end

into belongs_to.rb.

it didn't work

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>