public
Last active — forked from foca/user.rb

  • Download Gist
user.rb
Ruby
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

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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.