--- !ruby/object:RI::MethodDescription 
aliases: 
- !ruby/object:RI::AliasName 
  name: validates_size_of
block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: "Validates that the specified attribute matches the length restrictions supplied. Only one option can be used at a time:"
- !ruby/struct:SM::Flow::VERB 
  body: "  class Person &lt; ActiveRecord::Base\n    validates_length_of :first_name, :maximum=&gt;30\n    validates_length_of :last_name, :maximum=&gt;30, :message=&gt;&quot;less than %d if you don't mind&quot;\n    validates_length_of :fax, :in =&gt; 7..32, :allow_nil =&gt; true\n    validates_length_of :phone, :in =&gt; 7..32, :allow_blank =&gt; true\n    validates_length_of :user_name, :within =&gt; 6..20, :too_long =&gt; &quot;pick a shorter name&quot;, :too_short =&gt; &quot;pick a longer name&quot;\n    validates_length_of :fav_bra_size, :minimum=&gt;1, :too_short=&gt;&quot;please enter at least %d character&quot;\n    validates_length_of :smurf_leader, :is=&gt;4, :message=&gt;&quot;papa is spelled with %d characters... don't play me.&quot;\n  end\n"
- !ruby/struct:SM::Flow::P 
  body: "Configuration options:"
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>minimum</tt> - The minimum size of the attribute
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>maximum</tt> - The maximum size of the attribute
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>is</tt> - The exact size of the attribute
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>within</tt> - A range specifying the minimum and maximum size of the attribute
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>in</tt> - A synonym(or alias) for :within
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>allow_nil</tt> - Attribute may be nil; skip validation.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>allow_blank</tt> - Attribute may be blank; skip validation.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>too_long</tt> - The error message if the attribute goes over the maximum (default is: &quot;is too long (maximum is %d characters)&quot;)"
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>too_short</tt> - The error message if the attribute goes under the minimum (default is: &quot;is too short (min is %d characters)&quot;)"
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>wrong_length</tt> - The error message if using the :is method and the attribute is the wrong size (default is: &quot;is the wrong length (should be %d characters)&quot;)"
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>message</tt> - The error message to use for a :minimum, :maximum, or :is violation. An alias of the appropriate too_long/too_short/wrong_length message
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>on</tt> - Specifies when this validation is active (default is :save, other options :create, :update)
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>if</tt> - Specifies a method, proc or string to call to determine if the validation should occur (e.g. :if =&gt; :allow_validation, or :if =&gt; Proc.new { |user| user.signup_step &gt; 2 }). The method, proc or string should return or evaluate to a true or false value.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>unless</tt> - Specifies a method, proc or string to call to determine if the validation should not occur (e.g. :unless =&gt; :skip_validation, or :unless =&gt; Proc.new { |user| user.signup_step &lt;= 2 }). The method, proc or string should return or evaluate to a true or false value.
  type: :BULLET
full_name: ActiveRecord::Validations::ClassMethods#validates_length_of
is_singleton: false
name: validates_length_of
params: (*attrs)
visibility: public
