Displaying 2 results from an estimated 2 matches for "find_by_username_and_password".
2008 Jun 16
2
simple rails login system
...login system, but I''ve run into a glitch.
###user_controller.rb###
class UserController < ApplicationController
def login
@title = "Log In"
if request.post? and params[:user]
@user = User.new(params[:user])
@userfind =
User.find_by_username_and_password(@user.username,@user.password)
if @userfind
redirect_to :action => "index"
else
render :text => "Login Failed"
end
end
end
def index
db = Mysql.conn...
2005 Nov 03
0
AR model and virtual attributes
...has_many :owned_things, :class_name => "Thing", :conditions => ''user_id =
#{id} and location_id = #{location_id}''
attr_accessor :location_id
end
class AccountController < ApplicationController
def login
# load user info and set location
@session[:user] = User.find_by_username_and_password(...)
@session[:user].location_id = @params[:location_id]
end
end
Chris
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails