Skip to content

Instantly share code, notes, and snippets.

@ysv
Created August 5, 2019 13:21
Show Gist options
  • Save ysv/6551483edf1fde9b1e2ed0558858bc3b to your computer and use it in GitHub Desktop.
Save ysv/6551483edf1fde9b1e2ed0558858bc3b to your computer and use it in GitHub Desktop.
CURRENCY_PARAMS = {
name: { desc: -> { API::V2::Admin::Entities::Currency.documentation[:name][:desc] } },
deposit_fee: {
type: { value: BigDecimal, message: 'admin.currency.non_decimal_deposit_fee' },
values: { value: -> (p){ p >= 0 }, message: 'admin.currency.invalid_deposit_fee' },
desc: -> { API::V2::Admin::Entities::Currency.documentation[:deposit_fee][:desc] },
default: 0.0
}
#...
}
params :create_currency_params do
CURRENCY_PARAMS.each do
# Use values from CURRENCY_PARAMS with default values
end
end
params :update_currency_params do
CURRENCY_PARAMS.each do
# Use values from CURRENCY_PARAMS without default values
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment