rails 4.0.0发布,版本强迫更新症发作
By admin
非技术文,记录一下。
今看rails api的文档一个链接点不开了,一刷新发现版本变了。
just go 4.0
6月25日就发布了,我落后了…
之前于工教的mfs的事先暂缓一下。
change logs
controller里的params不能直接用了,需要require 后在permit
activerecord的update_attributes 加了个简便的alias — update
migration里的定义可以直接加index,不用再之后add_index了,如t.string :name, index: true
也可以直接t.index :name
join table有了自己的create_join_table
所有controller里的before_filter都改成before_action
after 和 around的也同改。
所有controller里的params给model的赋值也都得先require & permit
所有model的scope 改 -> {where xxx}
has_many的restrict改成restrict_with_error,连带着controller里的destroy也不用rescure了,直接用flash显示错误就行。
升级到4.0不像2升到3变化那么大,也没有3.0到3.1的时候加了assets这些东西,大概算是平滑过度。