Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
class User < ActiveRecord::Base
validates_presence_of :login
validates_length_of :login, :minimum => 3, :maximum => 40, :too_short => "should be at least 3 characters long", :too_long => "can't be anymore than 40 characters long"
validates_uniqueness_of :login
end
@matthewl
Owner

Just refactoring the original snippet as a little exercise. I didn't know that :too_long and :too_short existed for validates_length_of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.