search for: find_by_screen_name_and_password

Displaying 5 results from an estimated 5 matches for "find_by_screen_name_and_password".

2012 Apr 25
8
showing error (gsub) when switching from session to cookies
...-2.0.2/lib/action_controller/cookies.rb:65:in `[]='' app/controllers/user_controller.rb:27:in `login'' user_controller if request.get? @user = User.new(:remember_me => cookies[:remember_me] || "0") elsif param_posted?(:user) @user = User.new(params[:user]) user = User.find_by_screen_name_and_password(@user.screen_name, @user.password) if user user.login!(session) if @user.remember_me == "1" cookies[:remember_me] = { :value => "1", :expires => 10.years.from_now } user.authorization_token = user.id user.save! cookies[:authorization_token] = { :value => user.authoriz...
2011 Jan 24
11
Can't get login to work
...ser_id] = @user.id flash[:notice] = "User with login #{@user.screen_name} created!" redirect_to :action => :index end end end end def login @title = "Title" if request.post? @user = User1.new(params[:user1]) user = User.find_by_screen_name_and_password(@user.screen_name, @user.password) if user session[:user_id] = user.id flash[:notice] = "User #{user.screen_name} logged in" redirect_to :action => "index" else # Don''t show the password in the view @user.password =...
2010 Mar 21
3
Error in the code Doube Render (colins')
...so if you want to exit an action after redirecting, you need to do something like "redirect_to(...) and return". I feel that something is wrong with this code def login @title = "Login - Books" if request.post? @user = User.new(params[:user]) user = User.find_by_screen_name_and_password(@user.screen_name, @user.password) if user session[:user_id] = user.id flash[:notice] = "User #{user.screen_name} logged in" redirect_to :action => "index" else # Don''t show the password in the view @user.password =...
2010 Jul 31
4
Exception: can't dup Symbol
Hey everybody, I''m trying to test a little piece of code I wrote, and I get the following error: Exception: can''t dup Symbol It happens in the following line: try_to_login @valid_user, :remember_me => "1", where the function try_to_login is: def try_to_login(user, options = {}) user_hash = {:screen_name => user.screen_name, :password => user.password}
2010 Aug 14
10
Redirecting after logging in
Hey everybody, I''m trying to make an example of a small networking site, and when I log in a user, it should redirect and show his profile, but I get the following error: NoMethodError in User#index Showing app/views/user/index.html.erb where line #5 raised: undefined method `screen_name'' for nil:NilClass Extracted source (around line #5): 2: Your basic information 3: