From the course: Ruby on Rails 5 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Finishing touches

Finishing touches - Ruby on Rails Tutorial

From the course: Ruby on Rails 5 Essential Training

Start my 1-month free trial

Finishing touches

- [Narrator] There's one last finishing touch that we're going to make to our simple CMS project. In our admin area, we have something that says logged in as, and the idea that I had in mind is that it would show the username of the current logged in user right there. But we've never added that in. Let's see how we can do that now. If we go to our controller, for access controller, that's where we'll find the menu. So the menu is what needs to display it. So let's go ahead and let's just add here something that says username equals and then we need to get the person's username. So how do we know what their username is? Well one way we could do it is that we know their user id, that's stored in the session and we know that we have that because we've confirmed that they're logged in. So when we get to the menu page, we should definitely have a user id, we can go to the database, and we can look up that user, bring back their information. Now if we needed to go to the database to have…

Contents