Render form partial in a different controller (not nested)

前端 未结 2 1544
既然无缘
既然无缘 2020-12-29 07:53

I have two models generated with generate scaffolding, one is a LogBook the other is LogEntry. I want to render the form partial for LogEntry on the LogBook show page. Whe

2条回答
  •  借酒劲吻你
    2020-12-29 08:27

    Try switching the render method as follows:

    <%= render :partial => 'log_entries/form', :log_entry => @log_book.LogEntries.new %>
    

    Using just render works when passing an instance variable of the object. However, since you're specifying a file, it's best to use the option.

提交回复
热议问题