class PollOption < ActiveRecord::Base
belongs_to :poll
has_one :address
end
class Address < ActiveRecord::Base
belongs_to :user, :poll_options
apply_addresslogic :fields => [[:number, :street], :city, [:state, :zip_code]]
end
Those are my relevant models. Any ideas?
I kinda just need a good example.
This should answer:
http://archives.ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes
The main idea is to declare
accepts_nested_attributes_for :addressin your PollOption model and to change your form as indicated in the step 2 of the link I provided.Another useful link: http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html