Rails 4.0 will encourage developers to use the shared record pattern in controllers. Scaffold generators in Rails 4.0 will use by default. Here's an example of using the pattern.
class PostController < ActionController::Base before_action :set_post, except: [:index, :new, :create] def show # do something with @post end private def set_post @post = Post.find(params[:id]) end end
Basically, instead of calling
delete actions manually, you do it once in the
Attentive readers may have noticed another change:
before_filter will be called
before_action in Rails 4.0.
You're the 8216th person to read this article.