You can clone with
class User < ActiveRecord::Base
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"
Just refactoring the original snippet as a little exercise. I didn't know that :too_long and :too_short existed for validates_length_of.