Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Tony Kim
2,031 PointsWondering if you can use link_to in a drop down menu
<ul class="nav navbar-nav navbar-right">
<% if user_signed_in? %>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= current_user.full_name%><b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/users/edit">Profile Edit</a></li>
<li><a href="#">Setting</a></li>
<li><% link_to "Proflie Edit", edit_user_registration_path %></li>
<li class="divider"></li>
<li><a href="users/sign_out">Sign Out</a></li> <%# destroy_user_session_path option would go here as well %>
</ul>
</li>
<% end %
so in the video navigation links in ruby on rails customizing forms
I wanted to do a drop down menu instead of just a list with the full_name link so like on lines 5 this works but i wanted to see if there was a way to do it like line 7 where you use the <%= link_to "Profile Edit", edit_user_registration_path %>?
Also i can't sign out without the destroy_user_session method so pretty much need help with figuring this out
2 Answers
Jason Seifer
Treehouse Guest TeacherHi Tony Kim! I'm afraid I don't understand all of your questions. Can you be a little more specific on what you're trying to accomplish? Also, on line 7, you'll need to change the <% in to <%= in order for the output to display.
You can use link_to anywhere in your markup on the page here. In the case of the sign out link, it would look like this:
<li><%= link_to "Sign Out", destroy_user_session_path %></li>
Tony Kim
2,031 Pointsi realized what i did wrong you actually answered the question! Thank you Jason i totally forgot the "="