Class: SmartCollection::Validator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
lib/smart_collection/validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



3
4
5
6
7
8
# File 'lib/smart_collection/validator.rb', line 3

def validate record
  # try to build scope
  record.association(record.smart_collection_mixin.config.items_name).scope
rescue Exception => e
  record.errors.add(:failed_to_build_scope, e)
end