I\'m receiving a JSON package like:
{
\"point_code\" : { \"guid\" : \"f6a0805a-3404-403c-8af3-bfddf9d334f2\" }
}
I would like to tell Rai
Although a lot of these answers show you how to get what you're asking for, I would like to add to these answers and suggest that you use a before_action
. If the required params are missing, require
will automatically return a 400 error
class SomeController < ApplicationController
before_action :ensure_valid_params, only: :index
def index
# do your stuff
end
private
def ensure_valid_params
params.require(:some_required_param)
end
end