访问 Ruby on Rails 中的配置文件

问题描述 投票:0回答:0

我试图让用户(未登录)在点击“您的个人资料”后被定向到登录页面

enter image description here

class ProfileController < ApplicationController
before_action :authenticate_user!
  def user_profile
    render(:template => "profile/my_profile.html.erb")
  end
end```


I tried to include  "before_action :authenticate_user!" inside my controller for the profile but I received an error: undefined method `authenticate_user!'

I have a separate controller for authenticating the user
ruby-on-rails ruby ruby-on-rails-3
© www.soinside.com 2019 - 2024. All rights reserved.