Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jaycfields committed Nov 4, 2007
1 parent b32544c commit 3c22809
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/validatable_instance_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ def increment_times_validated_for(validation) #:nodoc:
end
end

# call-seq: validate_only(key)
#
# Only executes a specified validation. The argument should follow a pattern based on the key of the validation.
# Examples:
# * validates_presence_of :name can be run with obj.validate_only("presence_of/name")
# * validates_presence_of :birthday, :key => "a key" can be run with obj.validate_only("presence_of/a key")
def validate_only(key)
validation_name, attribute_name = key.split("/")
validation_name = validation_name.split("_").collect{|word| word.capitalize}.join
Expand Down

0 comments on commit 3c22809

Please sign in to comment.