【问题标题】:How to add user_signed_in? in template angularjs如何添加 user_signed_in?在模板中
【发布时间】:2014-12-26 06:33:22
【问题描述】:

我尝试使用 user_signed_in? (宝石设计)在 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 method 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  

【问题讨论】:

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


    【解决方案1】:

    看来你不见了

    before_action :authenticate_user!
    

    在conrtoller中,与此模板相关的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-27
      • 2012-11-18
      • 2010-10-17
      • 2019-08-08
      • 1970-01-01
      • 2020-12-15
      • 2019-09-03
      • 2018-02-02
      相关资源
      最近更新 更多