Rails redirect to assoc model after create -


I have a @miniatures model and a @lines model I have joined @ minelines model @miniature show view in this link

   <% = Link_to "Add to product line", new_miniline_path (: miniature_id => gt; @miniature)% & gt;  

For a new @ minillin form which takes : miniature_id from the hidden field

 < Code> & lt;% = f.hidden_field: miniature_id ,: value = & gt; @ Miniature.id% & gt;  

and then select the desired @line from the dropdown.

All this works

>

Code> New and create actions in the administrator

  def new @ minilin = minillin.new ( @niniliterar) @muneature = miniature.find (parameter [: miniature_id]) @lines = line. Make all FFs @ minilin = minilin.nu (minilin_param) if @niniline.ave flash [: success] = "miniature pair in product line" redirect_to miniature_path (@miniature) and flash [: success] = "did not work !! ! " Trying different options for  miniature_path (@miniature)  as plain  @miniature  and , end the 'new' end  

> Miniature (MiniIID) but no use. I suspect that my problem is with the : miniature_id to the @Minelines model. Any help is greatly appreciated because I am beating my head for an hour or two.

   

You did not set up in Settlement Setup

You can also do

  redirect_to @ miniline.miniature  

Comments