在我的靜態頁面home.html.erb方法`個人資料」的紅寶石,我有一個StaticPagesController參考。我相信我正確地做這個,但是仍然得到未定義的局部變量或方法`個人資料」。未定義的局部變量或on Rails的
StaticPagesController
class StaticPagesController < ApplicationController
def profile
redirect_to profile_path(current_user)
end
end
home.html.erb
<% if logged_in? %>
<% profile %>
<% else %>
<h1>Welcome to myProjects</h1>
<%= link_to "Sign up!", signup_path, class: "btn btn-lg btn-primary" %>
<% end %>
Pragash答案是正確的,但究竟什麼是你想怎麼辦? – jonathanrz