"form_tag xx_path" issue

Hello, there:
I create the following controller and view to handle login and
logou, but the form_tag always said “undefined local variable or
method `session_path’ for #ActionView::Base:0xb590e7e0” when I try
open the “login” (new) page. Any idea why? Thanks!

===================
Controller

class SessionsController < ApplicationController
def new
end

def create
self.current_user = User.authenticate(params[:login],
params[:password])
if logged_in?
if params[:remember_me] == “1”
self.current_user.remember_me
cookies[:auth_token] = { :value =>
self.current_user.remember_token , :expires =>
self.current_user.remember_token_expires_at }
end
redirect_back_or_default(’/’)
flash[:notice] = “Logged in successfully”
else
render :action => ‘new’
end
end

==========
View

<% form_tag session_path do -%>

Login
<%= text_field_tag 'login' %>

Password
<%= password_field_tag 'password' %>

<%= check_box_tag 'remember_me' %>Remember me:

<%= submit_tag 'Log in' %> <%= link_to "Forgot Password?", forgot_password_url %>

<% end -%>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs