0
我想重構我的3.0應用到運行3.2.8的另一臺服務器,並且它出現了路由語法可能已經改變了一點?Rails 3.2.8 - 路由和link_to_paths
鑑於這種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...
^):