Невозможно запустить mongrel после добавления базовой проверки подлинности HTML - PullRequest
0 голосов
/ 30 августа 2010

Это вывод, который я получаю при попытке запустить Mongrel:

root@marley:/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

Вот мой файл 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 == "h@x0rz"
    end
  end
end

1 Ответ

0 голосов
/ 30 августа 2010

Проблема с линией before_filter; Мое первое предположение состоит в том, что вы должны попытаться использовать before_filter вместо before_filters (это правильная функция в Rails 2.3.x, не уверена, была ли она там изменена), и мое следующее предположение, что определение функции для authenticate_or_request_with_http_basic не определен в вашем проекте - похоже, что вы заморозили Rails в своем проекте, поэтому вы просто должны иметь возможность выполнить поиск по всему дереву проекта за def authenticate_or_request_with_http_basic, чтобы посмотреть, есть ли оно там.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...