Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails ';当前页面&x27;不处理应用程序布局_Ruby On Rails_Ruby - Fatal编程技术网

Ruby on rails ';当前页面&x27;不处理应用程序布局

Ruby on rails ';当前页面&x27;不处理应用程序布局,ruby-on-rails,ruby,Ruby On Rails,Ruby,我有一个显示商店列表的rails应用程序。我试图让它在用户位于shops页面(/merchant/:username)时隐藏标题 在my application.html.erb中 <% if current_page?(menu_path) %> <% else %> <%= render "shared/header" %> <% end %> 我还尝试: <% if current_page?(:controlle

我有一个显示商店列表的rails应用程序。我试图让它在用户位于shops页面(/merchant/:username)时隐藏标题

在my application.html.erb中

<% if current_page?(menu_path) %>
<% else %>
<%= render "shared/header" %>
<% end %>
我还尝试:

<% if current_page?(:controller => 'merchants', :action => 'show') %>

您的路线需要一个参数(
:username
),当您在主页上时,该参数不存在

您可以尝试以下方法:


编辑:添加了
controller\u name


也许您可以使用
content\u来查看商家视图中的部分内容。

我认为您在当前的帮助页面中缺少用户名键

当前页面?(控制器:'merchants',操作:'show',用户名:'example')

什么是当前页面返回?谢谢,这很有效,但是如果我有另一个控制器也有一个名为“show”的操作,那么我假设这也会隐藏该路由的标题,这是一种仅为商户控制器指定标题的方法吗?当然,您可以使用
控制器名称
。我更新了我的答案。
<% if current_page?(:controller => 'merchants', :action => 'show') %>
No route matches {:action=>"show", :controller=>"merchants"}
No route matches {:action=>"show", :controller=>"merchants"}, missing required keys: [:username]