0
這是輸出試圖啓動雜種狗當我之後開始雜種:無法加入基本的HTML認證
[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
這裏是我的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
將「before_filters」更改爲「before_filter」修復了它。謝謝您的意見。非常感謝。 – rsouthard 2010-08-31 02:28:58