Topic: Display details of current logged in user.

How do you display details such as user name, e-mail, first name of ONLY CURRENTLY logged in user.

The following code display screen name of every user registered (which I don't want) __________________________________________________________________________________________________

app/controllers/user_controller.rb - index action

  def index
    @users = User.find(:all)
  end
__________________________________________________________________________________________________

app/views/user/index.html.erb
<h1>Users</h1>
<ol>
<% @users.each do |user| %>
  <li><%= user.screen_name %></li>
<% end %>
</ol>
__________________________________________________________________________________________________

I've searched books, websites but always been unsuccessful.

I would really appreciate your help.

Thanks,

Re: Display details of current logged in user.

What authentication system are you using?

Authlogic = current_user

<%= current_user.name %>
<%= current_user.email %>
...

Re: Display details of current logged in user.

Hi jmesserer,

I've figured out the answer, thanks for your help anyway.