Class: BrowsePageValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- BrowsePageValidator
- Defined in:
- app/validators/browse_page_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate(record) ⇒ Object
2 3 4 5 6 7 8 |
# File 'app/validators/browse_page_validator.rb', line 2 def validate(record) if (browse_pages = record.browse_pages) if browse_pages.uniq.count < browse_pages.count record.errors.add(:browse_pages, "can't have duplicates") end end end |