J'ai suivi les étapes décrites dans rack-recaptcha readme.Impossible de démarrer le serveur avec la gemme "rack-recaptcha"
J'ai fait toutes les étapes, au lieu de "Vous devez exiger 'rack-recaptcha' dans votre gemfile."
serveur ne peut pas démarrer, en raison d'une erreur suivant:
Booting Mongrel => Rails 2.3.5 application starting on http://127.0.0.1:3001 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in `load_missing_constant' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing' /{path_to_my_project}/config/environment.rb:29 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:111:in `run' /{path_to_my_project}/config/environment.rb:9 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:84 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' ./script/server:3 /Library/Ruby/Gems/1.8/gems/ruby-debug-ide-0.4.9/lib/ruby-debug-ide.rb:109:in `debug_load' /Library/Ruby/Gems/1.8/gems/ruby-debug-ide-0.4.9/lib/ruby-debug-ide.rb:109:in `debug_program' /Library/Ruby/Gems/1.8/gems/ruby-debug-ide-0.4.9/bin/rdebug-ide:87 /usr/bin/rdebug-ide:19:in `load' /usr/bin/rdebug-ide:19 -e:2:in `load' -e:2 Uncaught exception: uninitialized constant Rack::Recaptcha
Je pense, l'étape avec « Gemfile », que je suis sautée, est la raison de cette erreur. Mais, je ne sais pas, où devrais-je chercher le «gemfile» mentionné?
Aide, s'il vous plaît
Mise à jour:
environment.rb suit
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Add additional load paths for your own custom dirs
#config.load_paths += %W(#{RAILS_ROOT}/extras)
config.load_paths += %W(#{RAILS_ROOT}/public)
# Specify gems that this application depends on and have them installed with rake gems:install
# config.gem "bj"
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
config.gem "sqlite3-ruby", :lib => "sqlite3"
# config.gem "aws-s3", :lib => "aws/s3"
# NOTE: jquery.js must be updated to the latest version 1.4.2
# to avoid differences in behaviour of HTML makeup and Rails
config.gem 'jrails'
config.gem 'nokogiri
config.gem 'uuid
config.gem 'rack-recaptcha', :lib => 'rack/recaptcha'
config.middleware.use Rack::Recaptcha, :public_key => 'my_secret', :private_key => 'my_secret', :paths => 'http://localhost:3001/my_controller'
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Skip frameworks you're not going to use. To use Rails without a database,
# you must remove the Active Record framework.
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
config.active_record.observers = :user_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names.
config.time_zone = 'UTC'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
config.i18n.default_locale = :ru
end
J'ai d'abord fait exactement cela, mais il se plaint à la ligne: /{path_to_my_project}/config/environment.rb:29 qui contient config .middleware.use Rack :: Recaptcha,: public_key => 'KEY',: private_key => 'SECRET',: paths => 'PATH' Cela ne fonctionne toujours pas, affichant les mêmes erreurs – AntonAL
Et vous vous êtes assurés que la ligne 'config.gem' apparaît ** avant ** votre ligne' config.middleware.use'? – bjg
Oui, j'en suis sûr. J'ai ajouté la liste à ma question. – AntonAL