Class | ActiveModel::Errors |
In: |
lib/active_model/dynamic_errors.rb
|
Parent: | Object |
Redefine the ActiveModel::Errors::full_messages method:
Returns all the full error messages in an array. 'Base' messages are handled as usual. Non-base messages are prefixed with the attribute name as usual UNLESS
(1) they begin with ’^’ in which case the attribute name is omitted.
E.g. validates_acceptance_of :accepted_terms, :message => '^Please accept the terms of service'
(2) the message is a proc, in which case the proc is invoked on the model object.
E.g. validates_presence_of :assessment_answer_option_id, :message => Proc.new { |aa| "#{aa.label} (#{aa.group_label}) is required" } which gives an error message like: Rate (Accuracy) is required