Not forgetting before_action in Rails
There is a new way of setting up your arguments in the Rails framework version 4.2.4. It relies on the set_post action inside your controller.
# Use callbacks to share common setup or constraints between actions.
def set_post
@post = Post.find(params[:id])
end
Forgetting to set this up and now calling it properly right after your controller class declaration will result in the following error.
> First argument in form cannot contain nil or be empty
In order to mitigate this error, always ensure that before_action is set with :set_post... or any other model you generated.
before_action :set_post, only: [:show, :edit, :update, :destroy]