Hi,

try the following:

class Post < ActiveRecord::Base
  validates :name ,  :presence => { :message=>"Post name can't be blank."
}
end

Maksim.


Am 20.09.2010 14:49, schrieb Mike Disuza:
> Hi,
> I am developing an application in rails 3.0
> 
> I have post Model
> class Post < ActiveRecord::Base
>   validates :name ,  :presence => true
> end
> 
> I have added the presence of validation on post name.
> It shows me error that "Name can't be blank"
> 
> I have to give the custom message for the user so I have written like as
> follows:-
> 
> class Post < ActiveRecord::Base
>   validates :name ,  :presence => true , :message=>"Post name can't be
> blank."
> end
> 
> But it is giving me error:-
> "Unknown validator: 'message'"
> 
> Can anyone tell me How to give the custom message in rails 3 model
> validations?
> 
> Thanks,
> Mike

-- 
Maksim Gudovsikov
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
gudovsi...@webit.de | www.webit.de

Amtsgericht Dresden | HRB 15422
USt-ID DE 193477690
Geschäftsführer Sven Haubold

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to