Skip to content
Create a gist now

Instantly share code, notes, and snippets.

@matthewl /user.rb forked from foca/user.rb
Created Oct 11, 2010

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

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.