This project is archived and is in readonly mode.

#4269 ✓invalid
Martin Plöger

build through an association does not set the back-reference in Rails 3.0.0

Reported by Martin Plöger | March 25th, 2010 @ 09:46 PM

When I call the #build-method on an association the reference back (belongs_to) in the newly created instance is still nil. # => nil

This makes it difficult when there are validations on the built object like 'validates_presence_of :active_record_model'.
These fail it this scenario: # => false

You have to use a workaround like that: :active_record_model => @active_record_model # => true

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=""></a>

People watching this ticket