Try overriding error_messages_for(). Here is an example that may work for you.
def error_messages_for(object_name)
if object_name == :page && !flash[:error].nil?
return content_tag(:div, content_tag(:ul, content_tag(:li,
flash[:error])), :class => "flash error")
end
object = assigns["#{object_name.to_s}"]
if object && !object.errors.empty?
content_tag(:div,
content_tag(:ul, object.errors.collect {
|attribute, msg| content_tag(:li, msg) }),
:class => "flash error")
else
''''
end
end
Hope this helps,
Zack
On 8/7/06, Guest <na@na.na> wrote:> How can I modify the flash message that is displayed on a validates_*
> check? I used the :message => "" parameter, but it still gives
me an
> annoying "Test : Please ensure you have entered the test
message". I
> wanted to get rid of the "Test: " and the above "6 errors
prohibited
> this table from being saved" I looked at the source of
> validates_presence_of and I only found the :message, nothing else to
> help me validate. Can someone help me?
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>