ruby on rails - APIPIE custom missing parameter message -
i have used following apipie code action instead of missing message getting standard "missing parameter ip_address"
api :post, '/addresses.json', "create new address user. access token required" error :code => 401, :desc => "unauthorized" error :code => 422, :desc => "invalid params" param :address, hash, :desc => "address info", :required => true param :ip_address, string, :desc => "ip address", :required => true, :missing_message => lambda { i18n.t("ip_address.required") } param :address_line, string, :desc => "address line", :required => true, :missing_message => "address line cant empty" param :city, string, :desc => "city", :required => true param :pincode, string, :desc => "pincode" end
this rescue code.
rescue_from apipie::paramerror |e| puts e render json: e.message, status: 422 end
this getting "missing parameter ip_address". have passed address hash missing ip_address
seems had use master apipie instead of 0.3.5.
gem 'apipie-rails', :github => 'apipie/apipie-rails', :branch => 'master'
Comments
Post a Comment