Login not working

I have a Ruby on Rails site with a simple user login and with my combo to login I get:


We're sorry, but something went wrong.

We've been notified about this issue and we'll take a look at it shortly.

With (500) at the top bad request? Is there anyway to trace this to see what the problem is.

I already ran migrate and restarted as well.

Thanks,

Ryan
LVL 1
catonthecouchproductionsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Andrew DoadesIT TechnicianCommented:
Have you got some code from the login action/ authenticate action and maybe a copy of the log, from when you get this error?
These would help greatly in solving the problem.

Andrew
0
catonthecouchproductionsAuthor Commented:
Thats what i was asking, what log could I find it in? Not mogrel right?

Let me check out the action and paste it.
0
catonthecouchproductionsAuthor Commented:
You go to: http://bestqualitypools.info/promo_images to login and it redirects you to: http://bestqualitypools.info/session/new


Below is my session controller:
# This controller handles the login/logout function of the site.  
class SessionsController < ApplicationController
 
 
  # render new.rhtml
  def new
  end
 
  def create
    logout_keeping_session!
    user = User.authenticate(params[:login], params[:password])
    if user
      # Protects against session fixation attacks, causes request forgery
      # protection if user resubmits an earlier form using back
      # button. Uncomment if you understand the tradeoffs.
      # reset_session
      self.current_user = user
      new_cookie_flag = (params[:remember_me] == "1")
      handle_remember_cookie! new_cookie_flag
      redirect_back_or_default('/')
      flash[:notice] = "Logged in successfully"
    else
      note_failed_signin
      @login       = params[:login]
      @remember_me = params[:remember_me]
      render :action => 'new'
    end
  end
 
  def destroy
    logout_killing_session!
    flash[:notice] = "You have been logged out."
    redirect_back_or_default('/')
  end
 
protected
  # Track failed login attempts
  def note_failed_signin
    flash[:error] = "Couldn't log you in as '#{params[:login]}'"
    logger.warn "Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}"
  end
end

Open in new window

0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Andrew DoadesIT TechnicianCommented:
the log should be in
project folder/log and it will be called production.log

I also noticed that when I to a test login to the site, I get the rails "somethings gone wrong" page, you can setup ExceptionNotifiable that will send an email, and still log any rails errors found. Doing this might be a good idea for the future as you will get notified with details about all errors automatically..

http://super-exception-notifier.googlecode.com/svn/trunk/super_exception_notifier/README

Andrew
0
catonthecouchproductionsAuthor Commented:
Thank you, check out what i pasted below, I think it was this segment. Let me check that out. Thanks for the tip
Processing PromoImagesController#index (for 24.147.93.27 at 2009-05-05 09:22:05) [GET]
  Session ID: c7644701154b49043ec77134d0f87428
  Parameters: {"action"=>"index", "controller"=>"promo_images"}
Redirected to http://bestqualitypools.info/session/new
Filter chain halted as [:login_required] rendered_or_redirected.
Completed in 0.00161 (619 reqs/sec) | DB: 0.00026 (15%) | 302 Found [http://bestqualitypools.info/promo_images]
 
 
Processing SessionsController#new (for 24.147.93.27 at 2009-05-05 09:22:05) [GET]
  Session ID: BAh7BzoOcmV0dXJuX3RvIhIvcHJvbW9faW1hZ2VzIgpmbGFzaElDOidBY3Rp
b25Db250cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA--8407848421004b55e8f6355732f7cf8134bf5a5d
  Parameters: {"action"=>"new", "controller"=>"sessions"}
Rendering template within layouts/application
Rendering sessions/new
Completed in 0.00303 (330 reqs/sec) | Rendering: 0.00285 (94%) | DB: 0.00000 (0%) | 200 OK [http://bestqualitypools.info/session/new]
 
 
Processing SessionsController#create (for 24.147.93.27 at 2009-05-05 09:22:21) [POST]
  Session ID: BAh7CDoOcmV0dXJuX3RvIhIvcHJvbW9faW1hZ2VzOgxjc3JmX2lkIiUyOTM4
N2FkMmVkYjA1MmNkZDI5NGUyZGY1OWQwYzBjZCIKZmxhc2hJQzonQWN0aW9u
Q29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==--364a787737499ac56806772c1935e8d19dcea133
  Parameters: {"commit"=>"Log in", "authenticity_token"=>"139fcbedfddeeefaff61b21ac04210684340806c", "action"=>"create", "controller"=>"sessions", "password"=>"2377MCDONALD", "login"=>"villamike@aol.com"}
 
 
NameError (uninitialized constant User::Authentication):
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:493:in `const_missing'
    /app/models/user.rb:4
    /home/66747/data/rubygems/lib/rubygems/custom_require.rb:31:in `gem_original_require'
    /home/66747/data/rubygems/lib/rubygems/custom_require.rb:31:in `require'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:510:in `require'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:510:in `require'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:102:in `require_or_load'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:261:in `load_missing_constant'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:468:in `const_missing'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:480:in `const_missing'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:273:in `load_missing_constant'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:468:in `const_missing'
    /lib/authenticated_system.rb:138:in `logout_keeping_session!'
    /app/controllers/sessions_controller.rb:10:in `create'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `perform_action_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:579:in `call_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:572:in `perform_action_without_benchmark'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
    /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
    /vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:568:in `process_without_session_management_support'
    /vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `process'
    /vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in `handle_request'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/rails.rb:76:in `process'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/rails.rb:74:in `synchronize'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/rails.rb:74:in `process'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:159:in `process_client'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:158:in `each'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:158:in `process_client'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `initialize'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `new'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:268:in `initialize'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:268:in `new'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:268:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/configurator.rb:282:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/configurator.rb:281:in `each'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/configurator.rb:281:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/mongrel_rails:128:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/command.rb:212:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/mongrel_rails:281
    /home/66747/data/rubygems/gems/bin/mongrel_rails:19:in `load'
    /home/66747/data/rubygems/gems/bin/mongrel_rails:19
 
Rendering /home/66747/containers/rails/bestqualitypools/public/500.html (500 Internal Server Error)
 
 
Processing IndexController#sales (for 209.85.238.28 at 2009-05-05 11:47:48) [GET]
  Session ID: 46aa367061d6e7a1f31ceb5801ce9837
  Parameters: {"action"=>"sales", "controller"=>"index"}
 
 
NoMethodError (undefined method `has_attachment' for PromoImage(Table doesn't exist):Class):
    /vendor/rails/activerecord/lib/active_record/base.rb:1672:in `method_missing'
    /app/models/promo_image.rb:6
    /home/66747/data/rubygems/lib/rubygems/custom_require.rb:31:in `gem_original_require'
    /home/66747/data/rubygems/lib/rubygems/custom_require.rb:31:in `require'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:510:in `require'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:510:in `require'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:102:in `require_or_load'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:261:in `load_missing_constant'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:468:in `const_missing'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:480:in `const_missing'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:486:in `send'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:486:in `const_missing'
    /app/controllers/index_controller.rb:49:in `sales'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `perform_action_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:579:in `call_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:572:in `perform_action_without_benchmark'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
    /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
    /vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:568:in `process_without_session_management_support'
    /vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `process'
    /vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in `handle_request'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/rails.rb:76:in `process'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/rails.rb:74:in `synchronize'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/rails.rb:74:in `process'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:159:in `process_client'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:158:in `each'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:158:in `process_client'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `initialize'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `new'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:268:in `initialize'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:268:in `new'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:268:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/configurator.rb:282:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/configurator.rb:281:in `each'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/configurator.rb:281:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/mongrel_rails:128:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/command.rb:212:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/mongrel_rails:281
    /home/66747/data/rubygems/gems/bin/mongrel_rails:19:in `load'
    /home/66747/data/rubygems/gems/bin/mongrel_rails:19
 
Rendering /home/66747/containers/rails/bestqualitypools/public/500.html (500 Internal Server Error)
 
 
Processing IndexController#sales (for 209.85.238.28 at 2009-05-05 11:48:48) [GET]
  Session ID: 9afa57fbd20436e14f8ae713c2cdb945
  Parameters: {"action"=>"sales", "controller"=>"index"}

Open in new window

0
Andrew DoadesIT TechnicianCommented:
Found where you problem is
NameError (uninitialized constant User::Authentication):
    /app/models/user.rb:4

Can you past the user.rb model (remove any secret suff)
Just the action that contains like 4, something there is messing it up, as it tries to authenticate the user by the looks of it
0
catonthecouchproductionsAuthor Commented:
Hey Doades, thank you. Check out the post below:
require 'digest/sha1'
 
class User < ActiveRecord::Base
  include Authentication
  include Authentication::ByPassword
  include Authentication::ByCookieToken
 
  validates_presence_of     :login
  validates_length_of       :login,    :within => 3..40
  validates_uniqueness_of   :login
  validates_format_of       :login,    :with => Authentication.login_regex, :message => Authentication.bad_login_message
 
  validates_format_of       :name,     :with => Authentication.name_regex,  :message => Authentication.bad_name_message, :allow_nil => true
  validates_length_of       :name,     :maximum => 100
 
  validates_presence_of     :email
  validates_length_of       :email,    :within => 6..100 #r@a.wk
  validates_uniqueness_of   :email
  validates_format_of       :email,    :with => Authentication.email_regex, :message => Authentication.bad_email_message
 
  
 
  # HACK HACK HACK -- how to do attr_accessible from here?
  # prevents a user from submitting a crafted form that bypasses activation
  # anything else you want your user to change should be added here.
  attr_accessible :login, :email, :name, :password, :password_confirmation
 
 
 
  # Authenticates a user by their login name and unencrypted password.  Returns the user or nil.
  #
  # uff.  this is really an authorization, not authentication routine.  
  # We really need a Dispatch Chain here or something.
  # This will also let us return a human error message.
  #
  def self.authenticate(login, password)
    return nil if login.blank? || password.blank?
    u = find_by_login(login) # need to get the salt
    u && u.authenticated?(password) ? u : nil
  end
 
  def login=(value)
    write_attribute :login, (value ? value.downcase : nil)
  end
 
  def email=(value)
    write_attribute :email, (value ? value.downcase : nil)
  end
 
  protected
    
 
 
end

Open in new window

0
Andrew DoadesIT TechnicianCommented:
brilliant..

Now I can see that on line 4 we have this "include Authentication"

This appears to be causing the login problems, as I suspect this is what authenticates the user?

I have never come across using this before, can you maybe help ME and explain what adding this line in does? :)

Andrew
0
Andrew DoadesIT TechnicianCommented:
Might I also suggest you try and remove line 4?

I had a google around about what that line is/ does within the code, and some people saying it causes problems..

Its worth a try I suppose, it might be that it then moved onto the next line and moans at its

include Authentication::ByPassword

But we can easily narrow it down, fairly fast

Andrew
0
catonthecouchproductionsAuthor Commented:
Hey,

Line four being:

 # include Authentication

i commented it out.


Then try running it and see what i get?
0
Andrew DoadesIT TechnicianCommented:
Yea, better if you comment out, JUST in case we do need it!
0
catonthecouchproductionsAuthor Commented:
I hear ya on that!! Check out from my log bellow.
Processing SessionsController#new (for 74.69.229.154 at 2009-05-09 06:52:41) [GET]
  Session ID: BAh7CDoOcmV0dXJuX3RvIhIvcHJvbW9faW1hZ2VzOgxjc3JmX2lkIiUzNjNi
MGVmYzk4ZTE2NGZiNzgyMGIyOTA0ODc5Y2NhNyIKZmxhc2hJQzonQWN0aW9u
Q29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==--e5ac85f4fddda86114a65f7dc9478b498d43d22a
  Parameters: {"action"=>"new", "controller"=>"sessions"}
Rendering template within layouts/application
Rendering sessions/new
Completed in 0.00346 (289 reqs/sec) | Rendering: 0.00323 (93%) | DB: 0.00000 (0%) | 200 OK [http://bestqualitypools.info/session/new]
 
 
Processing SessionsController#create (for 74.69.229.154 at 2009-05-09 06:53:40) [POST]
  Session ID: BAh7CDoOcmV0dXJuX3RvIhIvcHJvbW9faW1hZ2VzOgxjc3JmX2lkIiUzNjNi
MGVmYzk4ZTE2NGZiNzgyMGIyOTA0ODc5Y2NhNyIKZmxhc2hJQzonQWN0aW9u
Q29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==--e5ac85f4fddda86114a65f7dc9478b498d43d22a
  Parameters: {"commit"=>"Log in", "authenticity_token"=>"9196d2d05518ea49dd043cdc7f5962d8b9282731", "action"=>"create", "controller"=>"sessions", "password"=>"pwhere", "login"=>"villamike@aol.com"}
 
 
NameError (uninitialized constant User::Authentication):
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:493:in `const_missing'
    /app/models/user.rb:5
    /home/66747/data/rubygems/lib/rubygems/custom_require.rb:31:in `gem_original_require'
    /home/66747/data/rubygems/lib/rubygems/custom_require.rb:31:in `require'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:510:in `require'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:510:in `require'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:102:in `require_or_load'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:261:in `load_missing_constant'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:468:in `const_missing'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:480:in `const_missing'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:273:in `load_missing_constant'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:468:in `const_missing'
    /lib/authenticated_system.rb:138:in `logout_keeping_session!'
    /app/controllers/sessions_controller.rb:10:in `create'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `perform_action_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:579:in `call_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:572:in `perform_action_without_benchmark'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
    /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
    /vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:568:in `process_without_session_management_support'
    /vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `process'
    /vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in `handle_request'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/rails.rb:76:in `process'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/rails.rb:74:in `synchronize'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/rails.rb:74:in `process'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:159:in `process_client'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:158:in `each'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:158:in `process_client'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `initialize'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `new'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:268:in `initialize'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:268:in `new'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:268:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/configurator.rb:282:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/configurator.rb:281:in `each'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/configurator.rb:281:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/mongrel_rails:128:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/command.rb:212:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/mongrel_rails:281
 
Rendering /home/66747/containers/rails/bestqualitypools/public/500.html (500 Internal Server Error)

Open in new window

0
Andrew DoadesIT TechnicianCommented:
Hmm it did as I thought it might, just moved onto the other line

NameError (uninitialized constant User::Authentication):
    /app/models/user.rb:5

Try to comment out lines 4, 5, and 6 and see if you get anywhere
  include Authentication
  include Authentication::ByPassword
  include Authentication::ByCookieToken

It seems to be something to do with this   include Authentication at the start of these lines!?
0
catonthecouchproductionsAuthor Commented:
Is it a GEM I am mising?
0
Andrew DoadesIT TechnicianCommented:
Funny, I was actually thinking along the same lines... look at this ruby forum post:

http://www.ruby-forum.com/topic/161369
0
catonthecouchproductionsAuthor Commented:
Below is the newest with it commented out.
Processing PromoImagesController#index (for 74.69.229.154 at 2009-05-09 07:02:37) [GET]
  Session ID: BAh7CDoOcmV0dXJuX3RvIhIvcHJvbW9faW1hZ2VzOgxjc3JmX2lkIiUzNjNi
MGVmYzk4ZTE2NGZiNzgyMGIyOTA0ODc5Y2NhNyIKZmxhc2hJQzonQWN0aW9u
Q29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==--e5ac85f4fddda86114a65f7dc9478b498d43d22a
  Parameters: {"action"=>"index", "controller"=>"promo_images"}
Redirected to http://bestqualitypools.info/session/new
Filter chain halted as [:login_required] rendered_or_redirected.
Completed in 0.00196 (509 reqs/sec) | DB: 0.00000 (0%) | 302 Found [http://bestqualitypools.info/promo_images]
 
 
Processing SessionsController#new (for 74.69.229.154 at 2009-05-09 07:02:37) [GET]
  Session ID: BAh7CDoOcmV0dXJuX3RvIhIvcHJvbW9faW1hZ2VzOgxjc3JmX2lkIiUzNjNi
MGVmYzk4ZTE2NGZiNzgyMGIyOTA0ODc5Y2NhNyIKZmxhc2hJQzonQWN0aW9u
Q29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==--e5ac85f4fddda86114a65f7dc9478b498d43d22a
  Parameters: {"action"=>"new", "controller"=>"sessions"}
Rendering template within layouts/application
Rendering sessions/new
Completed in 0.01265 (79 reqs/sec) | Rendering: 0.00587 (46%) | DB: 0.00000 (0%) | 200 OK [http://bestqualitypools.info/session/new]
 
 
Processing SessionsController#create (for 74.69.229.154 at 2009-05-09 07:03:05) [POST]
  Session ID: BAh7CDoOcmV0dXJuX3RvIhIvcHJvbW9faW1hZ2VzOgxjc3JmX2lkIiUzNjNi
MGVmYzk4ZTE2NGZiNzgyMGIyOTA0ODc5Y2NhNyIKZmxhc2hJQzonQWN0aW9u
Q29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==--e5ac85f4fddda86114a65f7dc9478b498d43d22a
  Parameters: {"commit"=>"Log in", "authenticity_token"=>"9196d2d05518ea49dd043cdc7f5962d8b9282731", "action"=>"create", "controller"=>"sessions", "password"=>"pw", "login"=>"villamike@aol.com"}
 
 
NameError (uninitialized constant User::Authentication):
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:493:in `const_missing'
    /app/models/user.rb:11
    /home/66747/data/rubygems/lib/rubygems/custom_require.rb:31:in `gem_original_require'
    /home/66747/data/rubygems/lib/rubygems/custom_require.rb:31:in `require'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:510:in `require'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:510:in `require'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:102:in `require_or_load'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:261:in `load_missing_constant'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:468:in `const_missing'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:480:in `const_missing'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:273:in `load_missing_constant'
    /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:468:in `const_missing'
    /lib/authenticated_system.rb:138:in `logout_keeping_session!'
    /app/controllers/sessions_controller.rb:10:in `create'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `perform_action_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:579:in `call_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:572:in `perform_action_without_benchmark'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
    /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
    /vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:568:in `process_without_session_management_support'
    /vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `process'
    /vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in `handle_request'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/rails.rb:76:in `process'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/rails.rb:74:in `synchronize'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/rails.rb:74:in `process'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:159:in `process_client'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:158:in `each'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:158:in `process_client'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `initialize'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `new'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:285:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:268:in `initialize'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:268:in `new'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel.rb:268:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/configurator.rb:282:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/configurator.rb:281:in `each'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/configurator.rb:281:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/mongrel_rails:128:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/../lib/mongrel/command.rb:212:in `run'
    /home/66747/data/rubygems/gems/gems/mongrel-1.1.5-x86-linux/bin/mongrel_rails:281
 
Rendering /home/66747/containers/rails/bestqualitypools/public/500.html (500 Internal Server Error)

Open in new window

0
Andrew DoadesIT TechnicianCommented:
Its defiantly something with the Authentication lines in the code, Looking at the forum post I found, it might be the browser is getting confused with the servers sessions?
 
" had this problem and after much work discovered that the session on
my browser was confusing the server somehow.  By deleting the cookie I
was able to access all the pages correctly without errors."

Have you tried clearing your Browser cache and cookies?
0
catonthecouchproductionsAuthor Commented:
Yeah, I just came across that and gave that a shot and also tried in Safari and still not working.
0
catonthecouchproductionsAuthor Commented:
Below is my gem list
actionmailer (2.1.2)
actionpack (2.1.2)
activerecord (2.1.2)
activeresource (2.1.2)
activesupport (2.1.2)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
fastthread (1.0.1)
gem_plugin (0.2.3)
mongrel (1.1.5)
mysql (2.7)
postgres (0.7.9.2008.01.28)
rails (2.3.2)
rake (0.8.4)
rmagick (1.15.15)
validatable (1.6.7)

Open in new window

0
catonthecouchproductionsAuthor Commented:
And if it helps after I login or try to, it redirects me to: http://bestqualitypools.info/session
0
catonthecouchproductionsAuthor Commented:
I think it is using this right: http://wiki.rubyonrails.org/howtos/authentication-authorization/restful-authentication

I didnt build this, a client came from another developer.
0
Andrew DoadesIT TechnicianCommented:
redirecting back to http://bestqualitypools.info/session will give you a 404 as you have no index action in the controller and in your code, you said to redirect_to ('/') with from what I know means it will try and go to the index action of the controller?
0
catonthecouchproductionsAuthor Commented:
Well I go to: http://bestqualitypools.info/promo_images then it redirects to: http://bestqualitypools.info/session/new then when I try to attempt to login it goes to: http://bestqualitypools.info/session

Let me know if that helps at all.
0
Andrew DoadesIT TechnicianCommented:
It might be using restful-authentication. I never used this as someone told me that is was the biggest pain when developing rails..

I have attached my User.rb model to this post, you can see how mine works, and how its different as I don't use restful-authentication...

I hope this helps a bit!!
0
catonthecouchproductionsAuthor Commented:
Thanks! Since I moved from an old server to a newer one..maybe it is not installed? Let me try to find out how, that might be it!
0
Andrew DoadesIT TechnicianCommented:
Oops, forgot the code lol
class User < ActiveRecord::Base
 
  attr_accessor :password_confirmation
  validates_confirmation_of :password
 
  def self.authenticate(name, password)
    user = self.find_by_name(name)
    if user
      expected_password = encrypted_password(password, user.salt)
      if user.hashed_password != expected_password
        user = nil
      end
    end
    user
  end
 
  def password
    @password
  end
 
  def password=(pwd)
    @password=pwd
    return if pwd.blank?
    create_new_salt
    self.hashed_password = User.encrypted_password(self.password, self.salt)
  end
 
  private
 
  def self.encrypted_password(password, salt)
    string_to_hash = password + "whatever" + salt
    Digest::SHA1.hexdigest(string_to_hash)
  end
 
  def create_new_salt
    self.salt = self.object_id.to_s + rand.to_s
  end
end

Open in new window

0
Andrew DoadesIT TechnicianCommented:
Might I also suggest you try this:

ruby script/plugin install http://svn.techno-weenie.net/projects/plugins/restful_authentication/
0
catonthecouchproductionsAuthor Commented:
I tried that but MediaTemple uses a different console/custom enviroment, i posted a ticket on they're support page.

I have ran and installed it locally before when I was starting rails and it worked fine. But I think if I can get it installed, im good to go!
0
Andrew DoadesIT TechnicianCommented:
I think now that its a restful-authentication problem, It would seem from the searching and digging that I have done that the restful-authentication plugin is perhaps missing or not installed correctly?

This seem to be the only obvious problem, I have checked your code and logs over and over and even asked one of my peers who is highly advanced in ruby and ruby on rails and we cant see anything wrong in the code itself.

Andrew
0
catonthecouchproductionsAuthor Commented:
I got it returning login not working. But this is because it has no users in the database. I am going to tryo find out how to add users.

Then it should work.

Any suggestions how to add a user?
0
Andrew DoadesIT TechnicianCommented:
I have attached a little script that if you store locally and just run "ruby add_user.rb" it should work. . you may need to add/remove a few fields but you will see how it works :)

This will also need putting in the base of the project folder
require 'rubygems'
 
rails_root = File.expand_path(File.join(File.dirname(__FILE__)))
RAILS_HOME = rails_root
RAILS_ENV="development"
 
require RAILS_HOME + '/config/environment'
 
print 'Username:'
username = gets.chomp
print 'Email:'
email = gets.chomp
print 'Password:'
password = gets.chomp
 
    # create  user
    user = User.new(:username => username,
                        :email => email,
                        :password => password
                        )
    user.save!

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
catonthecouchproductionsAuthor Commented:
Thanks for this! Hopefully this will do the trick.
0
Andrew DoadesIT TechnicianCommented:
No problem my Friend.. I'm here to help!

Hope it works too!!

Andrew
0
catonthecouchproductionsAuthor Commented:
After doing some research in to the files I needed, I found this worked GREAT

Appreciate it, do you have an email address I was going to write a blog post about this and share with others if they have this problem, to give credit out to you. Only fair :)

Thanks again Andrew.
require 'rubygems'
 
rails_root = File.expand_path(File.join(File.dirname(__FILE__)))
RAILS_HOME = rails_root
RAILS_ENV="development"
 
require RAILS_HOME + '/config/environment'
 
print 'Username:'
username = gets.chomp
 
print 'Login:'
login = gets.chomp
 
print 'Email:'
email = gets.chomp
 
print 'Password:'
password = gets.chomp
 
print 'Password Again:'
password_confirmation = gets.chomp 
 
    # create  user
    user = User.new(
    :username => username,
    :login => login,
    :email => email,
    :password => password,
    :password_confirmation => password
     )
    user.save!

Open in new window

0
Andrew DoadesIT TechnicianCommented:
My email is  andrew@doadesweb.co.uk

and I have no problem with making a blog and sharing the information.. I suspect a few other people will be getting stuck with this problem

Andrew
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Ruby

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.