Browsing articles in "General"
Mar
22

Code Syntax Highlight Test

By Marco  //  General  //  No Comments

Testing the code syntax highlight:

class Field < ActiveRecord::Base
#  validates_format_of :data, #validates the email address is a correct one
#     :with => /^([^@s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})$/i,
#     :message => "is not a valid email address"

# validates_inclusion_of :data,
#   :in => 1..99,
#   :message => "is out of bounds"

# validates_acceptance_of :check1,
#   :message => "was not checked"

# validates_confirmation_of :data,
#   :message => "should match confirmation"

# validates_length_of :data,
#  :maximum => 8,
#  :message => "its too long"

# validates_length_of :data,
#   :minimum => 4,
#   :message => "its too short"

  protected
  def validate
    errors.add(:data, "is not 'Steve'") unless data == "Steve"
  end
end