app/controllers/api/v1/shares_controller.rb
# Never trust parameters from the scary internet, only allow the white list through.
Never trust parameters from the scary internet, only allow the white list through.
Never trust parameters from the scary internet only allow the white list through .
def share_params
        begin
          if params[:share]   
            params.require(:share).permit(:original_filename, :public, :file, :tag_list)
          end
        rescue ActionController::UnpermittedParameters => e 
          render text: { status: 400, error: e.message }.to_json, :status => 400
        end
      end
def share_params begin if params [ :share ] params . require ( :share ) . permit ( :original_filename , :public , :file , :tag_list ) end rescue ActionController :: UnpermittedParameters => e render text : { status : 400 , error : e . message } . to_json , :status => 400 end end
Never trust parameters from the scary internet, only allow the white list through.
Never trust parameters from the scary internet only allow the white list through .
# if params[:share] fix the case when user click update button without selecting new file # only if action_on_unpermitted_parameters = :raise