Results 1 to 2 of 2
Thread: Problem with SitePoint RoR book
Jul 16, 2007, 06:26 #1
Problem with SitePoint RoR book
I seem to be having an odd problem with the login page html on page 240. I've downloaded the code archive and checked the latest errata but still doesn't work, I don't know if there is an error in my controller that might be causing it?
The odd thing is the form isn't showing at all. I am getting the application html (header, footer, layout etc) but no login form is being displayed. Here's my code, if anyone has any suggestions I'd be very greatful!
<% form_tag do %> <p>Please log in.</p> <p> <label>Username:</label> <%= text_field_tag 'login' %> </p> <p> <label>Password:</label> <%= password_field_tag 'password' %> </p> <p><%= submit_tag 'login' %></p> <% end %>
class AccountController < ApplicationController def login if request.post? @current_user = User.find_by_login_and_password(params[:login], params[:password]) unless @current_user.nil? session[:user_id] = @current_user.id redirect_to :controller => 'story' end end end def logout end end
Jul 17, 2007, 03:28 #2
- Join Date
- Feb 2006
- Worcs. UK
- 0 Post(s)
- 0 Thread(s)
Where is login.rhtml located. It should be in a folder within views that corresponds to the controller. So the file path should be app/views/account/login.rhtml judging by the controller name.
Also are you just not seeing a log on screen, or are you being redirected to a story view without being prompted to log on?