undefined method `config' for LoginEngine:Module (NoMethodError)
アプリケション起動時にエラーになる件の調査の続きだ。
http://d.hatena.ne.jp/kurusaki/20080702/p2
の続き。
アプリケーション起動時のエラー
"8795" => Booting WEBrick... ******************************************************************* * config.breakpoint_server has been deprecated and has no effect. * ******************************************************************* /Users/kuru/01_Projects/saikaiproject/skp001/vendor/plugins/login_engine/lib/login_engine.rb:14: undefined method `config' for LoginEngine:Module (NoMethodError) from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require' from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require' from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in' from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require' from /Users/kuru/01_Projects/saikaiproject/skp001/app/controllers/application.rb:3 from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:215:in `load_without_new_constant_marking' from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:215:in `load_file' ... 34 levels... from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require' from ./script/server:3 from -e:2:in `load' from -e:2
LoginEngineの設定を修正
http://blog.memoja.com/?p=32 を参考に進める。
config/environment.rbに下記の行を追加
#----- 2008.7.3 require File.join(RAILS_ROOT, "vendor", "plugins", "engines", "lib", "engines", "deprecated_config_support") #-----
config/environment.rbに下記の行を追加
#----- 2008.7.3 Rails::Initializer.run do |config| config.plugins = [ :engines, :all ] end #-----
修正後のconfig/environment.rb
# Be sure to restart your web server when you modify this file. # Uncomment below to force Rails into production mode when # you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') # 2008.7.2 #require File.join(RAILS_ROOT, "vendor", "plugins", "engines", # "lib", "engines", "deprecated_config_support") require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot') #----- 2008.7.3 require File.join(RAILS_ROOT, "vendor", "plugins", "engines", "lib", "engines", "deprecated_config_support") #----- Rails::Initializer.run do |config| # Settings in config/environments/* take precedence over those specified here # Skip frameworks you're not going to use (only works if using vendor/rails) # config.frameworks -= [ :action_web_service, :action_mailer ] # Only load the plugins named here, by default all plugins in vendor/plugins are loaded # config.plugins = %W( exception_notification ssl_requirement ) # 2008.7.2 # config.plugins = ["engines", "*"] #----- 2008.7.3 config.plugins = [ :engines, :all ] #----- # Add additional load paths for your own custom dirs # config.load_paths += %W( #{RAILS_ROOT}/extras ) # Force all environments to use the same logger level # (by default production uses :info, the others :debug) # config.log_level = :debug # Use the database for sessions instead of the file system # (create the session table with 'rake db:sessions:create') # config.action_controller.session_store = :active_record_store # Use SQL instead of Active Record's schema dumper when creating the test database. # This is necessary if your schema can't be completely dumped by the schema dumper, # like if you have constraints or database-specific column types # config.active_record.schema_format = :sql # Activate observers that should always be running # config.active_record.observers = :cacher, :garbage_collector # Make Active Record use UTC-base instead of local time # config.active_record.default_timezone = :utc # See Rails::Configuration for more options end # Add new inflection rules using the following format # (all these examples are active by default): # Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register "application/x-mobile", :mobile # Include your application configuration below module LoginEngine config :salt, "your-salt-here" config :use_email_notification, false config :user_table, "users" config :app_name, "atotok" end ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update :default => "%Y/%m/%d %H:%M:%S"
アプリケーションを起動してみる
"8994" => Booting WEBrick... /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- /Users/kuru/01_Projects/saikaiproject/skp001/vendor/plugins/engines/lib/engines/deprecated_config_support (MissingSourceFile) from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require' from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require' from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in' from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require' from /Users/kuru/01_Projects/saikaiproject/skp001/config/environment.rb:18 from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require' from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require' ... 10 levels... from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require' from ./script/server:3 from -e:2:in `load' from -e:2
vendor/plugins/engines/lib/engines/deprecated_config_support がマズいらしい。
http://blog.memoja.com/?p=32 を参考にすると
vendor/plugins/engines/lib/engines/deprecated_config_support.rb
Engines2.0をインストールする前にとっておき古いものをコピ−するとある。
やってない!!
古いMacBookに残っているかも?
deprecated_config_support.rbをコピ−する
古いMacBook Proにdeprecated_config_support.rbが残っていたので
それをコピーする。
deprecated_config_support.rbを
vendor/plugins/engines/lib/engines/deprecated_config_support.rb
にコピーする。
deprecated_config_support.rbの内容
# This file contains support for the now-deprecated +config+ method that the engines # plugin provided before version 1.2. Instead of using this, plugin authors are # now encouraged to create their own Module configuration mechanisms; the # +mattr_accessor+ mechanism provided by ActiveSupport is ideal for this: # # module MyPlugin # mattr_accessor :config_value # self.config_value = "default" # end # # == Using the deprecated config method # # If you require the config method to be present, change your <tt>environment.rb</tt> # file such that the very top of the file looks like this: # # require File.join(File.dirname(__FILE__), 'boot') # require File.join(RAILS_ROOT, "vendor", "plugins", "engines", # "lib", "engines", "deprecated_config_support") # # Adds the +config+ and +default_constant+ methods to Module. # # *IMPORTANT NOTE* - these methods are deprecated. Only use them when you have no # other choice. See link:files/lib/engines/deprecated_config_support_rb.html for more # information. class Module # Defines a constant within a module/class ONLY if that constant does # not already exist. # # This can be used to implement defaults in plugins/engines/libraries, e.g. # if a plugin module exists: # module MyPlugin # default_constant :MyDefault, "the_default_value" # end # # then developers can override this default by defining that constant at # some point *before* the module/plugin gets loaded (such as environment.rb) def default_constant(name, value) if !(name.is_a?(String) or name.is_a?(Symbol)) raise "Cannot use a #{name.class.name} ['#{name}'] object as a constant name" end if !self.const_defined?(name) self.class_eval("#{name} = #{value.inspect}") end end # A mechanism for defining configuration of Modules. With this # mechanism, default values for configuration can be provided within shareable # code, and the end user can customise the configuration without having to # provide all values. # # Example: # # module MyModule # config :param_one, "some value" # config :param_two, 12345 # end # # Those values can now be accessed by the following method # # MyModule.config :param_one # => "some value" # MyModule.config :param_two # => 12345 # # ... or, if you have overrriden the method 'config' # # MyModule::CONFIG[:param_one] # => "some value" # MyModule::CONFIG[:param_two] # => 12345 # # Once a value is stored in the configuration, it will not be altered # by subsequent assignments, unless a special flag is given: # # (later on in your code, most likely in another file) # module MyModule # config :param_one, "another value" # config :param_two, 98765, :force # end # # The configuration is now: # # MyModule.config :param_one # => "some value" # not changed # MyModule.config :param_two # => 98765 # # Configuration values can also be given as a Hash: # # MyModule.config :param1 => 'value1', :param2 => 'value2' # # Setting of these values can also be forced: # # MyModule.config :param1 => 'value3', :param2 => 'value4', :force => true # # A value of anything other than false or nil given for the :force key will # result in the new values *always* being set. def config(*args) raise "config expects at least one argument" if args.empty? # extract the arguments if args[0].is_a?(Hash) override = args[0][:force] args[0].delete(:force) args[0].each { |key, value| _handle_config(key, value, override)} else _handle_config(*args) end end private # Actually set the config values def _handle_config(name, value=nil, override=false) if !self.const_defined?("CONFIG") self.class_eval("CONFIG = {}") end if value != nil if override or self::CONFIG[name] == nil self::CONFIG[name] = value end else # if we pass an array of config keys to config(), # get the array of values back if name.is_a? Array name.map { |c| self::CONFIG[c] } else self::CONFIG[name] end end end end
アプリケーションを起動してみる
エラーになってしまう。
"9582" => Booting WEBrick... ******************************************************************* * config.breakpoint_server has been deprecated and has no effect. * ******************************************************************* /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:275:in `load_missing_constant': uninitialized constant ApplicationHelper::Localization (NameError) from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:467:in `const_missing' from /Users/kuru/01_Projects/saikaiproject/skp001/app/helpers/application_helper.rb:4 from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:215:in `load_without_new_constant_marking' from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:215:in `load_file' from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in' from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:214:in `load_file' from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:95:in `require_or_load_without_engine_additions' from /Users/kuru/01_Projects/saikaiproject/skp001/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb:129:in `require_or_load' ... 46 levels... from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require' from ./script/server:3 from -e:2:in `load' from -e:2
この時のapplication_helper.rb
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper include LoginEngine include Localization end
application_helper.rbを修正
取りあえず、エラーになっている4行目をコメント
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper include LoginEngine # include Localization end
アプリケーションを起動してみる。
"9795" => Booting WEBrick... ******************************************************************* * config.breakpoint_server has been deprecated and has no effect. * ******************************************************************* ******************************************************************* * config.breakpoint_server has been deprecated and has no effect. * ******************************************************************* => Rails 2.1.0 application started on http://0.0.0.0:3000 => Ctrl-C to shutdown server; call with --help for options [2008-07-03 23:00:48] INFO WEBrick 1.3.1 [2008-07-03 23:00:48] INFO ruby 1.8.6 (2008-03-03) [universal-darwin9.0] [2008-07-03 23:00:48] INFO WEBrick::HTTPServer#start: pid=9795 port=3000
http://localhost:3000/topにアクセスすると
500 Internal Server Error
になってしまう。
エラーとは関係ないと思うが、ApplicationControllerのサブクラスなど必要な箇所を修正する。
application.rb
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. require 'login_engine' class ApplicationController < ActionController::Base include LoginEngine # Pick a unique cookie name to distinguish our session data from others' session :session_key => '_skp001_session_id' end
atotok_controller.rb (ApplicationControllerのサブクラス)
require 'login_engine' class AtotokController < ApplicationController include LoginEngine helper :user model :user before_filter :login_required end
atotok_controller.rbを修正
http://blog.memoja.com/?p=32 をっ参考にし修正する。
atotok_controller.rb
require 'login_engine' class AtotokController < ApplicationController include LoginEngine helper :user require_dependency 'user' before_filter :login_required end
アプリケーションを起動してみる
"10810" => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails 2.1.0 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... ******************************************************************* * config.breakpoint_server has been deprecated and has no effect. * ******************************************************************* ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart). ** Rails signals registered. HUP => reload (without restart). It might not work well. ** Mongrel 1.1.4 available at 0.0.0.0:3000 ** Use CTRL-C to stop. DEPRECATION WARNING: config.action_view.cache_template_extensions option has been deprecated and has no affect. Please remove it from your config files. See http://www.rubyonrails.org/deprecation for details. (called from send at /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/initializer.rb:455) Attempting to copy plugin assets from '/Users/kuru/01_Projects/saikaiproject/skp001/vendor/plugins/login_engine/public' to '/Users/kuru/01_Projects/saikaiproject/skp001/public/plugin_assets' checking plugin 'engines' for 'application_helper' checking plugin 'login_engine' for 'application_helper' loading from application: application_helper
config.action_view.cache_template_extensionsがマズい
プロジェクト内をconfig.action_view.cache_template_extensionsで検索すると
config/environments/development.rbに設定がある。
config/environments/development.rb
# Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.cache_classes = false # Log error messages when you accidentally call methods on nil. config.whiny_nils = true # Enable the breakpoint server that script/breakpointer connects to config.breakpoint_server = true # Show full error reports and disable caching config.action_controller.consider_all_requests_local = true config.action_controller.perform_caching = false config.action_view.cache_template_extensions = false config.action_view.debug_rjs = true # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false
下記の行を削除する。
config.action_view.cache_template_extensions = false
修正後のconfig/environments/development.rb
# Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.cache_classes = false # Log error messages when you accidentally call methods on nil. config.whiny_nils = true # Enable the breakpoint server that script/breakpointer connects to config.breakpoint_server = true # Show full error reports and disable caching config.action_controller.consider_all_requests_local = true config.action_controller.perform_caching = false #config.action_view.cache_template_extensions = false config.action_view.debug_rjs = true # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false
アプリケーションを起動してみる
"10819" => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails 2.1.0 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... ******************************************************************* * config.breakpoint_server has been deprecated and has no effect. * ******************************************************************* ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart). ** Rails signals registered. HUP => reload (without restart). It might not work well. ** Mongrel 1.1.4 available at 0.0.0.0:3000 ** Use CTRL-C to stop. Attempting to copy plugin assets from '/Users/kuru/01_Projects/saikaiproject/skp001/vendor/plugins/login_engine/public' to '/Users/kuru/01_Projects/saikaiproject/skp001/public/plugin_assets' checking plugin 'engines' for 'application_helper' checking plugin 'login_engine' for 'application_helper' loading from application: application_helper
http://localhost:3000/top にアクセスしてみる
http://localhost:3000/topにアクセスしてみると
500 Internal Server Error
になってしまう。
"10819" => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails 2.1.0 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... ******************************************************************* * config.breakpoint_server has been deprecated and has no effect. * ******************************************************************* ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart). ** Rails signals registered. HUP => reload (without restart). It might not work well. ** Mongrel 1.1.4 available at 0.0.0.0:3000 ** Use CTRL-C to stop. Attempting to copy plugin assets from '/Users/kuru/01_Projects/saikaiproject/skp001/vendor/plugins/login_engine/public' to '/Users/kuru/01_Projects/saikaiproject/skp001/public/plugin_assets' checking plugin 'engines' for 'application_helper' checking plugin 'login_engine' for 'application_helper' loading from application: application_helper checking plugin 'engines' for 'top_controller' checking plugin 'login_engine' for 'top_controller' loading from application: top_controller checking plugin 'engines' for 'top_helper' checking plugin 'login_engine' for 'top_helper' loading from application: top_helper /!\ FAILSAFE /!\ 2008/07/04 01:15:45 Status: 500 Internal Server Error A secret is required to generate an integrity hash for cookie session data. Use config.action_controller.session = { :session_key => "_myapp_session", :secret => "some secret phrase of at least 30 characters" } in config/environment.rb /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session/cookie_store.rb:90:in `ensure_secret_secure' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session/cookie_store.rb:59:in `initialize' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/cgi/session.rb:273:in `new' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/cgi/session.rb:273:in `initialize_without_cgi_reader' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/cgi_ext/session.rb:39:in `initialize' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/cgi_process.rb:132:in `new' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/cgi_process.rb:132:in `session' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/cgi_process.rb:168:in `stale_session_check!' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/cgi_process.rb:116:in `session' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1135:in `assign_shortcuts_without_flash' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/flash.rb:166:in `assign_shortcuts' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:523:in `process_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:569:in `process_without_session_management_support' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:130:in `process' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:389:in `process' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:149:in `handle_request' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:in `dispatch' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `synchronize' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `dispatch' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:in `dispatch' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/rails.rb:76:in `process' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/rails.rb:74:in `synchronize' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/rails.rb:74:in `process' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:159:in `process_client' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in `each' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in `process_client' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `initialize' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `new' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `initialize' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `new' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:282:in `run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:281:in `each' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:281:in `run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/mongrel_rails:128:in `run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/command.rb:212:in `run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/mongrel_rails:281 /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load' /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load' /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in' /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load' /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/commands/servers/mongrel.rb:64 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require' /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require' /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in' /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require' /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require' ./script/server:3 -e:2:in `load' -e:2
config/environment.rbを修正
onfig/environment.rbに下記の記述を追加する。
config.action_controller.session = { :session_key => "_myapp_session", :secret => "some secret phrase of at least 30 characters" }
この時のconfig/environment.rb
# Be sure to restart your web server when you modify this file. # Uncomment below to force Rails into production mode when # you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot') require File.join(RAILS_ROOT, "vendor", "plugins", "engines", "lib", "engines", "deprecated_config_support") Rails::Initializer.run do |config| # Settings in config/environments/* take precedence over those specified here config.action_controller.session = { :session_key => "_myapp_session", :secret => "some secret phrase of at least 30 characters" } # Skip frameworks you're not going to use (only works if using vendor/rails) # config.frameworks -= [ :action_web_service, :action_mailer ] # Only load the plugins named here, by default all plugins in vendor/plugins are loaded # config.plugins = %W( exception_notification ssl_requirement ) config.plugins = [ :engines, :all ] # Add additional load paths for your own custom dirs # config.load_paths += %W( #{RAILS_ROOT}/extras ) # Force all environments to use the same logger level # (by default production uses :info, the others :debug) # config.log_level = :debug # Use the database for sessions instead of the file system # (create the session table with 'rake db:sessions:create') # config.action_controller.session_store = :active_record_store # Use SQL instead of Active Record's schema dumper when creating the test database. # This is necessary if your schema can't be completely dumped by the schema dumper, # like if you have constraints or database-specific column types # config.active_record.schema_format = :sql # Activate observers that should always be running # config.active_record.observers = :cacher, :garbage_collector # Make Active Record use UTC-base instead of local time # config.active_record.default_timezone = :utc # See Rails::Configuration for more options end # Add new inflection rules using the following format # (all these examples are active by default): # Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register "application/x-mobile", :mobile # Include your application configuration below module LoginEngine config :salt, "your-salt-here" config :use_email_notification, false config :user_table, "users" config :app_name, "atotok" end ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update :default => "%Y/%m/%d %H:%M:%S"
http://localhost:3000/top にアクセスしてみる
アプリケーションを起動しhttp://localhost:3000/top にアクセスするとエラーになるが
大分、状況がかなり変わった。
地道にエラーをつぶして行くしかないか...
今日はここまで