2010-08-30 8 views
0

Ceci est la sortie que je reçois en essayant de commencer Mongrel:Impossible de démarrer bâtarde après avoir ajouté l'authentification html de base

[email protected]:/home/rsouthard/projects/inventory# ruby script/server 
=> Booting Mongrel (use 'script/server webrick' to force WEBrick) 
=> Rails 2.2.3 application starting on http://0.0.0.0:3000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
** Starting Mongrel listening at 0.0.0.0:3000 
** Starting Rails with development environment... 
Exiting 
/home/rsouthard/projects/inventory/app/controllers/application.rb:5:in `before_filters': wrong number of arguments (1 for 0) (ArgumentError) 
    from /home/rsouthard/projects/inventory/app/controllers/application.rb:5 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:382:in `load_without_new_constant_marking' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:382:in `load_file' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:381:in `load_file' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:256:in `require_or_load' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:221:in `depend_on' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:133:in `require_dependency' 
    from /home/rsouthard/projects/inventory/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:20 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/callbacks.rb:182:in `call' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/callbacks.rb:182:in `evaluate_method' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/callbacks.rb:166:in `call' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/callbacks.rb:90:in `run' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/callbacks.rb:90:in `each' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/callbacks.rb:90:in `send' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/callbacks.rb:90:in `run' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/callbacks.rb:277:in `run_callbacks' 
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:559:in `send' 
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:559:in `prepare_dispatcher' 
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:173:in `process' 
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:112:in `send' 
    from ./script/../config/../vendor/rails/railties/lib/initializer.rb:112:in `run' 
    from /home/rsouthard/projects/inventory/config/environment.rb:13 
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require' 
    from /usr/lib/ruby/1.8/mongrel/rails.rb:147:in `rails' 
    from /usr/lib/ruby/1.8/mongrel_rails:114:in `cloaker_' 
    from /usr/lib/ruby/1.8/mongrel/configurator.rb:149:in `call' 
    from /usr/lib/ruby/1.8/mongrel/configurator.rb:149:in `listener' 
    from /usr/lib/ruby/1.8/mongrel_rails:100:in `cloaker_' 
    from /usr/lib/ruby/1.8/mongrel/configurator.rb:50:in `call' 
    from /usr/lib/ruby/1.8/mongrel/configurator.rb:50:in `initialize' 
    from /usr/lib/ruby/1.8/mongrel_rails:85:in `new' 
    from /usr/lib/ruby/1.8/mongrel_rails:85:in `run' 
    from /usr/lib/ruby/1.8/mongrel/command.rb:212:in `run' 
    from /usr/lib/ruby/1.8/mongrel_rails:282 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load_without_new_constant_marking' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:142:in `load' 
    from /home/rsouthard/projects/inventory/vendor/rails/railties/lib/commands/servers/mongrel.rb:64 
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in' 
    from /home/rsouthard/projects/inventory/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require' 
    from /home/rsouthard/projects/inventory/vendor/rails/railties/lib/commands/server.rb:49 
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    from script/server:3 

Voici mon fichier application.rb:

#added to this controller apply to all controllers in the application. 
# Likewise, all the methods added will be available for all controllers. 

class ApplicationController < ActionController::Base 
    before_filters :authenticate 

    helper :all # include all helpers, all the time 

    # See ActionController::RequestForgeryProtection for details 
    # Uncomment the :secret if you're not using the cookie session store 
    protect_from_forgery # :secret => '4c5b23214f61143c4957b30c72169daf' 

    # See ActionController::Base for details 
    # Uncomment this to filter the contents of submitted sensitive data parameters 
    # from your application log (in this case, all fields with names like "password"). 
    # filter_parameter_logging :password 
    private 
    def authenticate 
    authenticate_or_request_with_http_basic do |username, password| 
     username == "admin" && password == "[email protected]" 
    end 
    end 
end 

Répondre

0

Le problème est avec la ligne before_filter; ma première supposition est que vous devriez essayer d'utiliser before_filter plutôt que before_filters (c'est la fonction correcte dans Rails 2.3.x, pas sûr si elle a été changée là) et ma prochaine estimation est que la définition de la fonction pour authenticate_or_request_with_http_basic n'est pas définie dans votre projet - il semble que vous ayez gelé Rails dans votre projet, alors vous devriez juste être en mesure de grep votre arbre de projet entier pour def authenticate_or_request_with_http_basic pour voir si c'est là.

+0

La modification de "before_filters" à "before_filter" l'a corrigé. Merci pour votre participation. C'est apprécié. – rsouthard

Questions connexes