今天把一个程序切换到edge rails(revision=6688),发现了以下变化:
1. 需要安装 libopenssl-ruby,否则会有
[code]`const_missing': uninitialized constant ActionController::Base::DEPRECATED_INSTANCE_VARIABLES (NameError)
[/code]
2. URL中的" ; " 变成了“/”
[code]assert_select "a[href=/pages/#{page.id};edit]" [/code]
要改为
[code]
assert_select "a[href=/pages/#{page.id}/edit]" [/code]
3. AR默认对主键缓存对象实例
在1.2中
[code] ticket = Ticket.find(params[:id])
ticket2 = Ticket.find(params[:id])
ticket.update_attributes(params[:ticket])
ticket.name.should != ticket2.name[/code]
在edge rails中
[code]
ticket = Ticket.find(params[:id])
ticket2 = Ticket.find(params[:id])
ticket.update_attributes(params[:ticket])
ticket.name.should == ticket2.name[/code]
这个变化不用说也清楚,Rails 2.0对性能高度重视。
4. Application::helper_method 不见了
restful_authentication生成的代码中
[code] base.send :helper_method, :current_user, :logged_in?[/code]
会出错,因为找不到helper_method。
1. 需要安装 libopenssl-ruby,否则会有
[code]`const_missing': uninitialized constant ActionController::Base::DEPRECATED_INSTANCE_VARIABLES (NameError)
[/code]
2. URL中的" ; " 变成了“/”
[code]assert_select "a[href=/pages/#{page.id};edit]" [/code]
要改为
[code]
assert_select "a[href=/pages/#{page.id}/edit]" [/code]
3. AR默认对主键缓存对象实例
在1.2中
[code] ticket = Ticket.find(params[:id])
ticket2 = Ticket.find(params[:id])
ticket.update_attributes(params[:ticket])
ticket.name.should != ticket2.name[/code]
在edge rails中
[code]
ticket = Ticket.find(params[:id])
ticket2 = Ticket.find(params[:id])
ticket.update_attributes(params[:ticket])
ticket.name.should == ticket2.name[/code]
这个变化不用说也清楚,Rails 2.0对性能高度重视。
4. Application::helper_method 不见了
restful_authentication生成的代码中
[code] base.send :helper_method, :current_user, :logged_in?[/code]
会出错,因为找不到helper_method。