开发者

Rails - migrating from 3.0 to 3.1

I wanted to help out a open source project by migrating from 3 to 3.1

But I have never had to migrate a lar开发者_JAVA百科ge project before so I am looking for some advise ?

this is the project - https://github.com/locomotivecms/engine

Thanks, Alex


here it is an "almost working" locomotivecms code, migrated on rails 3.1:

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

... it is not ready for pull request,

infact it miss to replace /images/ whith /assets/ in all the relative path ..., anyway it start and stay up (despite many "DEPRECATION WARNING"), on rails 3.1 server:

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 console works fine as well :

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 > 

This is the guide I followed during my try :

  • http://davidjrice.co.uk/2011/05/25/how-to-upgrade-a-rails-application-to-version-3-1-0.html

    UPDATE: "Cannot modify SafeBuffer in place" error resolved

    UPDATE jun 23 11: resolved "ArgumentError (wrong number of arguments (4 for 3))" adding options param (the fourth) to set_session into lib/locomotive/session_store.rb b/lib/locomotive/session_store.rb Thanks to Nicholas Hubbard previous answer.


Reposting from GitHub:

It looks like the new sessions in 3.1 require 4 params: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb Line 61

def set_session(env, sid, session_data, options)

The store in locomotive only takes three: https://github.com/lgs/engine/blob/rails-3.1/lib/locomotive/session_store.rb Line 31 def set_session(env, sid, session_data)

Looks like options are being passed also that we are not expecting.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜