Say my user creates an Article and an Article has_many :links. The edit form for article contains an "add link" link_to_remote that brings up an edit line for links for further reading. The problem is that there is that the Article is not yet saved, so it''s unclear how to accumulate or remove these items. I''m sure others have implemented similar things. Hints? Thanks -- View this message in context: http://www.nabble.com/q%3A-master-child-where-children-are-added-with-ajax-t1513616.html#a4107705 Sent from the RubyOnRails Users forum at Nabble.com.
Say my user creates an Article and an Article has_many :links. The edit form for article contains an "add link" link_to_remote that brings up an edit line for links for further reading. The problem is that there is that the Article is not yet saved, so it''s unclear how to accumulate or remove these items. I''m sure others have implemented similar things. Hints? Thanks -- View this message in context: http://www.nabble.com/q%3A-master-child-where-children-are-added-with-ajax-t1513615.html#a4107704 Sent from the RubyOnRails Users forum at Nabble.com.
Steve Ross wrote:> Say my user creates an Article and an Article has_many :links. The edit > form > for article contains an "add link" link_to_remote that brings up an edit > line for links for further reading. The problem is that there is that > the > Article is not yet saved, so it''s unclear how to accumulate or remove > these > items. > > I''m sure others have implemented similar things. Hints? > > Thanks > -- > View this message in context: > http://www.nabble.com/q%3A-master-child-where-children-are-added-with-ajax-t1513615.html#a4107704 > Sent from the RubyOnRails Users forum at Nabble.com.Save the parent before using it then you have the ID. If the users cancels, destroy it -- Posted via http://www.ruby-forum.com/.
So you''re advocating: link_to_remote ''new child'', :url => {:action => ''do_something''} def do_something save_master_record fall_through_to_rjs_add_child_records end BTW: Sorry about the numerous posts of the same question. Nabble hung and I didn''t know whether the post got through. Maybe email *is* better :) -- View this message in context: http://www.nabble.com/q%3A-master-child-where-children-are-added-with-ajax-t1513615.html#a4110306 Sent from the RubyOnRails Users forum at Nabble.com.