私の静的ページhome.html.erbには、StaticPagesControllerへの参照があります。私はこれを正しくやっていると信じていますが、まだ未定義のローカル変数またはメソッド `profile 'を取得しています。Ruby on Railsの未定義のローカル変数またはメソッド `profile '
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