0

I'm not sure if what i'm trying to do is possible but i'd appreciate your ideas.

I have a nested form accepts a parent form and renders a partial. I want to dynamically add nested object. I've tried the implementation described in the Nested Model Form railscast but since the nested model is in itself complex and requires fields to be divided to two forms, this implementation turns out very clumsy..

What i'm trying to do is call an action remotly, add a nested object to the original model, and have that action render a js that appends the partial to be rendered. like this:

custom_action.js.erb

$('#room_info')
    .html("<%= j render(:partial => 'room_info', :locals => {:f => f }) %>");

Where room_info is a div nested under the parent form and "f" is the parent object's form. Is there any way to retrieve this form variable, "f"? Maybe with jQuery?

Any help will be appreciated. Thanks!

1 Answer 1

1

I ended up using this solution, answered a similar question with it here:

pass form builder in remote_function in rails?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.