Created — forked from foca/user.rb

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View user.rb
1 2 3 4 5
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
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.