Rails - 从3.0迁移到3.1

时间:2011-05-26 13:22:09

标签: ruby-on-rails-3 ruby-on-rails-3.1

我想通过从3迁移到3.1来帮助开源项目

但我之前从未有过迁移大型项目所以我正在寻找一些建议吗?

这是项目 - https://github.com/locomotivecms/engine

谢谢,Alex

2 个答案:

答案 0 :(得分:1)

这里是一个“几乎正常工作”的locomotivecms代码,迁移到rails 3.1:

https://github.com/lgs/engine/tree/rails-3.1

......还没有为拉请求做好准备,

实际上它错过了在所有相对路径中替换/ images / whith / assets / ... 无论如何,它开始并熬夜(尽管许多“DEPRECATION WARNING”),在rails 3.1服务器:

lsoave@ubuntu:~/rails/github/engine$ rails s
DEPRECATION WARNING: config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead. (called from <top (required)> at /home/lsoave/rails/github/engine/config/application.rb:9)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <top (required)> at /home/lsoave/rails/github/engine/config/application.rb:9)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <top (required)> at /home/lsoave/rails/github/engine/config/application.rb:9)
=> Booting WEBrick
=> Rails 3.1.0.rc4 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-06-22 01:54:34] INFO  WEBrick 1.3.1
[2011-06-22 01:54:34] INFO  ruby 1.9.2 (2010-12-25) [i686-linux]
[2011-06-22 01:54:34] INFO  WEBrick::HTTPServer#start: pid=2948 port=3000

Rails控制台也可以正常工作:

lsoave@ubuntu:~/rails/github/engine$ rails c
DEPRECATION WARNING: config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead. (called from <top (required)> at /home/lsoave/rails/github/engine/config/application.rb:9)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <top (required)> at /home/lsoave/rails/github/engine/config/application.rb:9)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <top (required)> at /home/lsoave/rails/github/engine/config/application.rb:9)

Loading development environment (Rails 3.1.0.rc4)
ruby-1.9.2-p136 :001 > 

这是我在尝试期间遵循的指南:

答案 1 :(得分:1)

从GitHub重新发布:

看起来3.1中的新会话需要4个参数: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb第61行

def set_session(env,sid,session_data,options)

机车店只需要三个: https://github.com/lgs/engine/blob/rails-3.1/lib/locomotive/session_store.rb第31行 def set_session(env,sid,session_data)

看起来我们没有想到也会传递选项。