Forum: Ruby on Rails Create a new parent on child form?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
75860c1351ea050f844be8d12caba365?d=identicon&s=25 Jeremy (Guest)
on 2009-06-06 20:09
(Received via mailing list)
I'm creating a little event management system and I have an Event
model and an Organization model.

# event.rb
belongs_to :organization

# organization.rb
has_many :events

When I'm creating a new event, I present a dropdown with already saved
organizations, but I'd like to add a "Create new organization" option
in there and then use Javascript to show the New organization form,
and then have the new event and new organization saved when submitted.

The javascript is not the problem, but figuring out the rest is.  I've
read over the tutorials where you can do nested models, but those seem
to only work *from* the parent (i.e. if I were creating a new
organization and wanted to create a bunch of new events at the same
time) rather than vice versa.

Can anyone help me out?
This topic is locked and can not be replied to.