我有一个Rails应用程序,在home/index.html.erb
页面上展示了一个workorders
模型的partial。它当前默认为home_controller.rb
下的index
操作。
我能否选择workorders_controller.rb
和index2
操作?
我在home/index.html.erb
视图文件中尝试过以下代码:
<%= render :partial => "workorders/index7", :controller => "workorders", :action => "index2" %>
但它没有起作用。
workorders/index7.html.erb
视图。我将其从_index7.html.erb
(一个局部视图)更改过来。但是,它没有执行workorders_controller.rb
中的 index7 操作。相反,它正在执行home_controller.rb
中的index
操作。 - Reddirthttp://localhost:5000/workorders/index7
,那么它会执行workorders
控制器中的index7
操作。但是,我希望它显示在主页上而不是单独的页面上。 - Reddirthttp://localhost:5000/workorders/index7
设为命名路由并在需要时调用它(比如说redirect_to index_seven_path
)?index7 动作是否总是会被调用,还是有条件的? - daxindex7
,另一个页面index8
呈现在第二个选项卡中。 - Reddirt