Skip to content

Commit

Permalink
Type option still works but is deprecated.
Browse files Browse the repository at this point in the history
  • Loading branch information
eirc committed Jan 16, 2012
1 parent 9ea89d0 commit 2c57ce9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/evelpidon_validators/credit_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ def self.valid_credit_card?(number, type)
end

def validate_each(record, attribute, value)
if options[:type]
warn "The :type option has been deprecated, please use :type_attribute instead."
options[:type_attribute] ||= options[:type]
end
unless self.class.valid_credit_card? value, record.send(options[:type_attribute])
record.errors.add(attribute, :credit_card, options)
end
Expand Down

0 comments on commit 2c57ce9

Please sign in to comment.