You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classFoosController < ApplicationControllerbefore_action:set_foo,only: [:show,:update,:destroy]# GET /foosdefindex@foos=Foo.allrenderjson: @foosend# GET /foos/1defshowrenderjson: @fooend# POST /foosdefcreate@foo=Foo.new(foo_params)if@foo.saverenderjson: @foo,status: :created,location: @fooelserenderjson: @foo.errors,status: :unprocessable_entityendend# PATCH/PUT /foos/1defupdateif@foo.update(foo_params)renderjson: @fooelserenderjson: @foo.errors,status: :unprocessable_entityendend# DELETE /foos/1defdestroy@foo.destroyendprivate# Use callbacks to share common setup or constraints between actions.defset_foo@foo=Foo.find(params[:id])end# Only allow a trusted parameter "white list" through.deffoo_paramsparams.fetch(:foo,{})endend