一、controller的paginate分页方法被拿掉了2.0以前controller带有paginate这个public的分页方法,现在已经不能使用了。现在推荐的是另外一个替代插件will_paginate,安装这个插件可以用如下的命令: ./script/plugin install svn://errtheblog.com/svn/plugins/will_paginate 关于will_paginate的用法可以参考这个插件里面自带的文档,用法非常简单,或者也可以看这篇博客:
http://errtheblog.com/posts/56-im-paginating-again
目前JavaEye2.0的代码也是使用controller的paginate,但是在我们JavaEye3.0代码里面,已经改成了will_paginate。
二、ActionWebServices这个gem包被拿掉了
Rails社区提倡REST,而不是SOAP,如果以前用了SOAP,那么也可以单独安装ActionWebServices,如果是新项目,还是用REST和ActiveResource吧。 三、controller里面的一些实例方法@params, @session, @request等被拿掉@params, @session, @request, @response, @headers, @flash这些实例方法被拿掉,而是在controller里面定义了同名的方法,所以请使用params, session, request, response, headers, flash 四、acts_as_list, acts_as_tree被拿掉acts_as_list, acts_as_tree被拿掉,放在Rails官方的SVN网站上面,现在如果你要用得话,请用插件安装,直接用命令 ./script/plugin install acts_as_list 就可以了。 五、in_place_editor和auto_complete这两个AJAX的helper被拿掉in_place_editor和auto_complete这两个AJAX的helper被拿掉了,放在Rails官方的SVN网站上面,如果你要用,也请安装插件,和上面一样。 六、start_form_tag 标签被拿掉表单标签现在改成了block格式的,例如
<% form_tag ... do |form| -%>
........
<% end -%>
七、一些写法的改变:1、:post => 'true'的写法改成了 :method => 'post'
2、find_all 改成 find :all, find_first 改成 find :first 这里有一个rake task,可以提示你需要修改哪些地方,并且帮助你自动修改: http://www.slashdotdash.net/articles/2007/12/03/rails-2-upgrade-notesattachment_fu 里面的Callbacks也不工作了。
genarate命令的scaffold_source也没有了,直接scaffold就行了
observer 没了,但还没发现有官方的声明提及这个事情,也不知道如何升级。
DEPRECATION WARNING: observer is deprecated and will be removed from Rails 2.0 See http://www.rubyonrails.org/deprecation for details.
ActionController中的scaffold :model也没有了