On 1 July 2011 12:51, Chirag Singhal <[email protected]> wrote:
> Checkout these two railscasts, they should get you started in right
> direction:
> http://railscasts.com/episodes/196-nested-model-form-part-1
> http://railscasts.com/episodes/197-nested-model-form-part-2

I've found that is more simpler than I've thought.

Models are:

Shop has_many :document, Document belongs_to :shop.

For edit action I've done:

@shop = Shop.find(params[:id])
@document = @shop.documents.new

and in the form I've done:

fields_for @document.

Now I can modify an existing shop and at the same time add a document.
Do you think it's all correct?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to