# Autosave no longer a valid option for belongs\_to?

**URL:** <https://www.ruby-forum.com/t/autosave-no-longer-a-valid-option-for-belongs-to/162526>\
**Category:** Rails\
**Created:** [March 10, 2009, 9:49pm UTC](https://www.ruby-forum.com/t/autosave-no-longer-a-valid-option-for-belongs-to/162526 "2009-03-10T21:49:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfoxny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@jfoxny](https://www.ruby-forum.com/u/jfoxny)\
**Post date:** [March 10, 2009, 9:49pm UTC](https://www.ruby-forum.com/t/autosave-no-longer-a-valid-option-for-belongs-to/162526/1 "2009-03-10T21:49:37Z")

</div>

The Rails API doc ([api.rubyonrails.org](http://api.rubyonrails.org)) says that :autosave is still a  
valid option for belongs\_to in the latest version of Rails. However, a  
look at the activerecord/lib/active\_record/associations.rb (line 1590)  
reveals that it is not in the @@valid\_keys\_for\_belongs\_to\_association  
array. I also noticed that it’s not in the ActiveRecord API doc  
([ar.rubyonrails.org](http://ar.rubyonrails.org)).

Does anyone have any more information on this? What is the current best  
practice for persisting your child objects when saving a parent object?  
Here’s an example:

class PaymentMethod \< ActiveRecord::Base  
belongs\_to :billing\_address, :class\_name =\> “Address”  
end  
class Address \< ActiveRecord::Base  
validates\_presence\_of :line\_one  
end  
class PaymentMethodsController \< ActionController::Base  
def update  
@pm = PaymentMethod.find(params[:id])  
@pm.billing\_address.line\_one = params[:billing\_address][:line\_one]  
# …  
if @pm.save  
# …  
end  
end  
end

Thanks in advance.

Jason

---

<div class="post-metadata">

**Author:** ![jfoxny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a6a055/32.png) [@jfoxny](https://www.ruby-forum.com/u/jfoxny)\
**Post date:** [June 4, 2009, 12:04pm UTC](https://www.ruby-forum.com/t/autosave-no-longer-a-valid-option-for-belongs-to/162526/2 "2009-06-04T12:04:34Z")

</div>

Whats the resolution for this?

On Mar 11, 1:49 am, Jason F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
