You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
572 B
19 lines
572 B
6 years ago
|
module RenderHelper
|
||
|
def render_ok(data = {})
|
||
|
render json: { status: 0, message: 'success' }.merge(data)
|
||
|
end
|
||
|
|
||
|
def render_error(message = '')
|
||
|
render json: { status: -1, message: message }
|
||
|
end
|
||
|
|
||
|
def render_not_found(message = I18n.t('error.record_not_found'))
|
||
|
render json: { status: 404, message: message }
|
||
|
# render status: 404, json: { errors: errors }
|
||
|
end
|
||
|
|
||
|
def render_forbidden(message = I18n.t('error.forbidden'))
|
||
|
render json: { status: 403, message: message }
|
||
|
# render status: 403, json: { errors: errors }
|
||
|
end
|
||
|
end
|