Undefined local variable or current_user method

I am building my first Ruby on Rails application (ruby 2.0.0p353) following the guidance of teamtreehouse.com .

I use dev 3.2.2 devise and in application.html.erb I want to use devuse "current_user" to display the name of the logged in user.

Here is the code in which I use "current_user":

    <ul class="nav navbar-nav pull-right">
      <li><%= link_to current_user.first_name, "#" %></li> 
      <li><%= link_to "Log Out", destroy_user_session_path, method: :delete %></li> 
    </ul>

routes.db:

Treebook::Application.routes.draw do
   devise_for :t_busers
   resources :statuses
   root to: 'statuses#index'
end

However, when I launch my application, I always get the following error:

undefined local variable or method `current_user' for #<#<Class:0x007f98b1d0edb8>:0x007f98b1cff6d8>

. , . , .., , . "before_filter: authenticate_user!". application_controller.rb, , .

-, , ?

+4
2

current_t_buser

devise

, "", "", , , :

before_filter: authenticate_member!

member_signed_in?

current_member

member_session

+4

:

devise_for :t_busers

devise_for :users

current_user. , User users.

+1

All Articles