Code: The benefit of before_actions
It is probable that some of our control actions, if written independently, would contain some of the same code. For example you may have an index, show and update action that all need to find a specific instance of a model. Rather than code the same line into each of the individually, we can create a separate method in the controller to do this and then call it before each of the actions using before_action.
Before_actions allow us to pass what method we are calling as well as specifying for what actions it needs to be called before. e.g.
before_action :get_tweet, only: [:edit, :update, :destroy]
They should be put at the top of a controller class.