Add documentation to validate_inclusion_of on qualifier

[ci skip]
This commit is contained in:
Mauro George 2015-03-28 11:48:31 -03:00 committed by Elliot Winkler
parent d31046d90c
commit 9a893f372d
1 changed files with 27 additions and 0 deletions

View File

@ -67,6 +67,33 @@ module Shoulda
#
# #### Qualifiers
#
# Use `on` if your validation applies only under a certain context.
#
# class Issue
# include ActiveModel::Model
# attr_accessor :severity
#
# validates_inclusion_of :severity,
# in: %w(low medium high),
# on: :create
# end
#
# # RSpec
# describe Issue do
# it do
# should validate_inclusion_of(:severity).
# in_array(%w(low medium high)).
# on(:create)
# end
# end
#
# # Test::Unit
# class IssueTest < ActiveSupport::TestCase
# should validate_inclusion_of(:severity).
# in_array(%w(low medium high)).
# on(:create)
# end
#
# ##### with_message
#
# Use `with_message` if you are using a custom validation message.