如何添加user_signed_in?在模板angularjs

时间:2014-12-26 06:33:23

标签: ruby-on-rails angularjs devise slim-lang

我尝试使用user_signed_in? (gem devise)在app / assets / templates / index.html.slim

我的代码:

 - unless user_signed_in?
   li ng-click='login()'
     a href='javascript:void(0)' translate='user.sign_in'
   li ng-click='register()'
     a href='javascript:void(0)' translate='user.sign_up'
  - else
     li
      a href=profile_path(current_user.id)

它显示错误:" underfine方法user_signed_in?"

信息路线

destroy_user_session_path   DELETE  /users/sign_out(.:format)   sessions#destroy
login_by_token_path     GET     /users/login_by_token/:token(.:format)  api/v1#api_user2
user_password_path  POST    /password(.:format)     front/passwords#create
new_user_password_path  GET     /password/new(.:format)     front/passwords#new

cancel_user_registration_path   GET     /cancel(.:format)   front/registrations#cancel
user_registration_path  POST    /   front/registrations#create
new_user_registration_path  GET     /sign_up(.:format)  front/registrations#new  

1 个答案:

答案 0 :(得分:0)

看起来你错过了

before_action :authenticate_user!

在控制器中,与此模板相关。