Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Rails 8 Course - Beginner to Intermediate!
Preview
Video Player
00:00
00:00
00:00
- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
This video covers improving user navigation in a Rails application by enhancing the navbar, adding an account edit link using Devise’s edit_user_registration_path, and verifying routes through the terminal.
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Okay, so guys, the next step on the agenda
is to actually make sure that we can view
0:00
the user's username who actually posted
the post and view when it was created.
0:03
And we're also going to
be adding a like button.
0:06
So let's go ahead and do that.
0:08
Okay, so the first thing that I want to do
is create a navbar for simpler navigation.
0:10
So go to App Views layouts and inside
of here we already have a navbar, but
0:13
I'm just going to make
it a little bit better.
0:17
So let's go ahead and wrap it in a div and
then let's create another link.
0:19
So just here we're going to say link_to.
0:23
And then we're gonna do home and
then inside here we'll just do root_pass.
0:26
That should be good.
0:31
So now we've got that.
0:32
And then we're just going to also bump up
the size of these actual links themselves.
0:33
So we're gonna go and
wrap them all in a h2.
0:37
So you want your h2 here and your h2 at
the end of all the links, then that's it.
0:40
So now that we've done that, we've kind of
got some better navigation going and so
0:45
if we go to the posts, we're actually
going to make it for that when we sign in.
0:48
So I'm just gonna sign in right now.
0:51
So sign in with one, two,
three, four, five, six login and
0:53
then I want to make a edit
user registration link.
0:56
So let's go ahead and do that.
0:58
So go to VS code and then we're going to
create a new link and when we're logged
1:00
in, we're going to create a new link and
we're gonna say edit, Edit user.
1:03
And so inside of here we're just gonna
say the path, we're gonna change it.
1:07
We're gonna do
edit_user_registration_path.
1:11
Now how do I know that that's
the place we want to go to?
1:15
Well, it's because when we go to
the terminal, if I stop the server and
1:18
then clear and
then run rails routes in here,
1:22
if we actually look at these routes that
are available to us, as you can see,
1:24
there's one called device
edit_user_registration.
1:29
Edit_user_registration down here.
1:32
And it's a get request.
1:34
And so that's how I know that
that's the one we need to go to.
1:35
Let's go back to VS code.
1:38
And then where it says Edit user,
we're just gonna do.
1:39
We're gonna get rid of this
data Turbo method delete.
1:41
We don't need that on this one.
1:43
And instead of edit user, we're
actually gonna change it to account and
1:45
that should be good.
1:48
If we refresh now, I just need to
restart the server, so run Rails S and
1:49
then you go back to the browser.
1:53
And as you can see now,
if we go to account, yeah,
1:55
we're actually able to see our account and
we can change our details if we want to.
1:58
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up