如果你升级完Rails 2.3.2 遇到了问题



最主要的提示是说:

uninitialized constant ApplicationController
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:443:in `load_missing_constant'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `const_missing'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:92:in `const_missing'
F:/ROR_SPACE/edepot/app/controllers/store_controller.rb:9


而去store_controller.rb去看

class StoreController < ApplicationController

也就是说找不到application.rb的定义,而当前的文件又确实有application.rb的定义。问题在那里呢?

原来是rails升级以后,application.rb默认文件名改了。这或者是“约定高于配置”的另一面,有人改了约定,我们还不太清楚。那么好吧,我把application.rb的文件名改成application_controller.rb。
接着想要运行,或者,还有一些东西要改cnfig/boot.rb里,那个典型的require_gem问题。

    else
      gem "rails"
      #require_gem "rails"
      require 'initializer'


然后,运行时有点升级

F:\ROR_SPACE\depot_l>rake db:migrate
(in F:/ROR_SPACE/depot_l)
rake aborted!
undefined method `require_gem' for main:Object
F:/ROR_SPACE/depot_l/rakefile:4
(See full trace by running task with --trace)

F:\ROR_SPACE\depot_l>rake db:migrate
(in F:/ROR_SPACE/depot_l)
Your config/boot.rb is outdated: Run "rake rails:update".

F:\ROR_SPACE\depot_l>rake rails:update
(in F:/ROR_SPACE/depot_l)
install -c -m 0755 c:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/../../bin/dbconsole script/dbconsole
F:/ROR_SPACE/depot_l/app/controllers/application.rb has been renamed to F:/ROR_SPACE/depot_l/app/controllers/application_controller.rb, update your SCM as necessary

这段说明也表明,文件名改了。

uninitialized constant FileColumn::ClassMethods::Inflector


如果你还有classic_paginate

那么,请记着也要改这个

options[:singular_name] ||= ActiveSupport::Inflector.singularize(collection_id.to_s)   
options[:class_name]  ||= ActiveSupport::Inflector.camelize(options[:singular_name])   
#      options[:singular_name] ||= Inflector.singularize(collection_id.to_s)   
#      options[:class_name]  ||= Inflector.camelize(options[:singular_name])  

你可能感兴趣的:(c,F#,Ruby,Rails,rack)