我正在尝试将我的 3.0 应用程序重构为另一台运行 3.2.8 的服务器,并且看起来路由语法可能有所改变?
鉴于此 routes.rb:
root :to => 'user_sessions#new'
match 'login' => 'user_sessions#new'
match 'logout' => 'user_sessions#destroy'
match 'usermenu' => 'users#menu'
match 'adminmenu' => 'users#adminmenu'
而这个观点:
<% if current_user %>
<%= link_to "Logout", logout_path %> |
<%= link_to "Main Menu", usermenu_path %> |
<%= link_to_if (current_user.admin == true, "Admin Menu", adminmenu_path) %>
<% end %>
我收到此错误:
ActionView::Template::Error (/home/-/layouts/application.html.erb:19: syntax error, unexpected ',', expecting ')'
...if (current_user.admin == true, "Admin Menu", adminmenu_path...
/home/-/layouts/application.html.erb:19: syntax error, unexpected ',', expecting ')'
...er.admin == true, "Admin Menu", adminmenu_path) );@output_bu...
^):