> If you have a user in current_user for example then the company is
> current_user.company, so the name is current_user.company.name.  Such
> is the magic of Rails.  Watch out for the cas when the user does not
> have a company, in which current_user.company will be nil.  Check out
> the rails guide on ActiveRecord relationships to see how this all
> works.

Thanks! This is what I did...

CONTROLLER
    current_user_id = session[:user_id]
    @current_user = User.find(current_user_id)

TEMPLATE
  <h2><%= @current_user.account.name %></h2>

Seems soo simple but it's not to us newbies.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to