Can it be you mispelled "validates_lenght_of"?
On 8/19/05, klmn <kelemen-3bu9hXS+wrdaa/9Udqfwiw@public.gmane.org>
wrote:> I''m trying validate date before they''re stored into the
DB, but it seems,
> validation doesn''t work..
>
> my model looks like this:
> class Company < ActiveRecord::Base
> has_many :contacts,
> :foreign_key =>''company_id''
> has_and_belongs_to_many :categories, :join_table =>
''company_to_category'',
> :foreign_key =>
''company_id'',
> :association_foreign_key =>
''category_id''
> validates_presence_of :name
> validates_uniqueness_of :name
> validates_lenght_of :name, :maximum => "20"
,:message => "too long"
> end
>
> The presence_of and the uniqueness_of work fine, but it doesn''t
throw any error
> when the name atribute is longer than 20..
>
> Is there any problem with it? Can I combine validate rules however I want
to, or
> it has some rules too..?
>
> thanks
>
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>