I’m new to RoR and the tutorials I’ve found on the web, while helpful,
aren’t as “complete” as I’d like them. I understand the basics when
it comes to layouts and routes, but I’m trying to get them to work
together.
MY first task was to implement a user authentication system
(registration/login/logout/change_password). This works fine with my
User controller/model/views. Now, I’ve made a default layout that
resembles the following:
[header]
[menubar]
[toolbar][main content]
[footer]
I made another controller called main that i am rendering into the
main content part of my layout. I’ve added a route to go to main/
index when at my url, so it’s the default page. The layout HTML looks
like this:
Now in my views/main/index.rhtml I have:
…
<% content_for :menubar do %>
<% link_to “Login”, :controller => “user”, :action => “Login” %>
<% end %>
This works great and puts the link into the menubar div. Only problem
now is that when i click it the site goes to /user/Login and I lose my
layout. Is there something I should be putting in my login function
in my user class? Or is there another route I should have?