Displaying 1 result from an estimated 1 matches for "paymentmethodscontrol".
2009 Mar 10
0
autosave no longer a valid option for belongs_to?
...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
--
Posted via http://www.ruby-forum.com/.
--~--~---------...