Open
Description
Hello,
I'm trying to override a nested attribute's name that gets show in the validation message, but it doesn't seem possible for nested params
I want to override registration[total_capacity]
attribute name:
my params:
params :sessions_params do
optional :registration_allowed, type: Boolean, desc: 'registration allowed for session?'
optional :registration, type: Hash, desc: 'session registration settings' do
requires :total_capacity, type: Integer, desc: 'session registration total capacity', message: :name_required
requires :waiting_list_enabled, type: Boolean, desc: 'is session registration waiting list enabled?'
end
end
en.yml
en:
grape:
errors:
format: ! '%{attributes} %{message}'
messages:
name_required: 'must be present'
attributes:
registration:
total_capacity: 'Total capacity'
expected error message if total capacity is not sent:
"Total capacity must be present"
actual error message:
"registration[total_capacity] must be present"
is this not possible or is there a problem with my code?
using grape 0.16.2, ruby 2.3.3, rails 4.2
thanks