Rails 4: before_filter vs. before_action
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In rails >4.0.0 generators creates CRUD operations with before_action not before_filter . It seems to do the same thing. So what's the difference between these two? 回答1: As we can see in ActionController::Base , before_action is just a new syntax for before_filter . However all before_filters syntax are deprecated in Rails 5.0 and will be removed in Rails 5.1 回答2: It is just syntax difference, in rails app there is CRUD, and seven actions basically by name index , new , create , show , update , edit , destroy . Rails 4 make it developer