eKek0
eKek0

Reputation: 23289

Rails 4 raises ArgumentError when using some syntax

In Ubuntu, ruby 2.0.0p247 and Rails 4.0.0 when I use the following syntax

validates :title, presence: true, length: { minimun: 5 }

I get the exception Range unspecified. Specify the :in, :within, :maximum, :minimum, or :is option..

Also, if I write

validates :title, :presence => true, :minimun => 5

I get the exception Unknown validator: 'MinimunValidator'.

How can I rewrite this so it works? As the guides says this should work, but it doesn't.

Upvotes: 0

Views: 479

Answers (2)

vee
vee

Reputation: 38645

You have a typo (minimun instead of minimum) which is why the error:

validates :title, presence: true, length: { minimum: 5 }

Upvotes: 3

Logan Serman
Logan Serman

Reputation: 29860

Use minimum instead of minimun...

Upvotes: 2

Related Questions