I want to show the validate - message in the flash[:error] - field but I
can't find any options.
class UserPermission < ActiveRecord::Base
:message => "Please insert a name"
flash[:error] = "Error - "
Has anybody a solution for this problem?
Thorsten Mueller wrote:
What's wrong with error_messages_for ?
error_messages_for and error_messages_on destroy the look and feel of
the application in this case.
Then most likely the only thing you can do is
manually going through the errors and add them
to the flash (or directly display them in the view)
@user_permission.errors.each_full do |msg|
will return them one by one as string
would return an array with all messages.
I'm quite sure, there is no direct way to tell the validators to do
anything but add the error to the models error object.
Thanks Thorsten for your helpful tip.
@user_permission.errors.full_messages() solve my problem.