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 - Ruby on Rails Tutorial
From the course: Ruby on Rails 5 Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Challenge: AdminUser CRUD2m 44s
-
(Locked)
Solution: AdminUser CRUD7m 56s
-
(Locked)
Public area10m 35s
-
(Locked)
Public area navigation6m 3s
-
(Locked)
Nesting pages in subjects9m 44s
-
(Locked)
Nesting sections in pages7m 37s
-
(Locked)
Adding RubyGems: acts_as_list8m 25s
-
(Locked)
Finishing touches3m 30s
-
(Locked)
-