ruby初学者的问题。。
各位大侠。。小弟用rails加载一个已有的项目。。启动服务的时候出点问题。小弟怎么也看不懂。望各位大侠指导。
我的rails是2.3.2和1.2.6。。gem是1.3.1。报错信息如下:
C:\>ruby d:\MDPwebsite\script\server
=> Booting WEBrick...
C:/Ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/initializer.rb:334:in `send': undefined method `session=' for ActionController
::Base:Class (NoMethodError)
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/initializer.rb:334:in `initialize_framework_settings'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/initializer.rb:333:in `each'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/initializer.rb:333:in `initialize_framework_settings'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/initializer.rb:330:in `each'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/initializer.rb:330:in `initialize_framework_settings'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/initializer.rb:100:in `process'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/initializer.rb:47:in `send'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/initializer.rb:47:in `run'
... 12 levels...
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/commands/server.rb:39
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from d:/MDPwebsite/script/server:3
[解决办法]
undefined method `session=' for ActionController::Base:Class
我猜测这项目不是用2.3.2写的,要不这rails底层类的方法应该不会找不着。换个旧点的rails试试。
[解决办法]
新建一个rail工程把app目录拷进去.
[解决办法]
rails 版本之间的差异是相当大的。
你的project 是否freeze 过。你看下 vendor/里是否有个rails文件夹。如果是的话,你解除这个,rake rails:unfreeze。并彻底删除这个文件夹。然后重新试下rails 1.2.6和 rails 2.2版本可否通过。
[解决办法]
设定文件,另外是不是你的gem不配套?
[解决办法]