【发布时间】:2016-07-24 06:57:14
【问题描述】:
在我的静态页面 home.html.erb 中,我引用了一个 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 的答案是正确的,但你到底想做什么?
标签: ruby-on-rails ruby