I have a model called Person that owns Venue. The classes are as followed:
app/models/person.rb
class Person < ActiveRecord::Base
attr_acessible :height
has_one :venue
end
app/models/venue.rb
class Venue < ActiveRecord::Base
attr_acessible :location
end
Now, if I wanted to make a form, it’d be like this if Person didn’t has_one Venue:
<%= form_for :person do |f| %>
<%= f.text_field :height %>
<% end %>
How would I do this if I wanted to create the Venue object for this Person with this form?
Figured it out. In this case, you’d use
fields_forto emulate the rendering of fields of your sub model.