Module: Dedupe::Orm::ActiveRecord

Extended by:
ActiveSupport::Concern
Includes:
Errors
Defined in:
lib/dedupe/orm/active_record.rb

Instance Method Summary collapse

Instance Method Details

#duplicate?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/dedupe/orm/active_record.rb', line 21

def duplicate?
  self.duplicates.present?
end

#duplicatesObject

Raises:



13
14
15
16
17
18
19
# File 'lib/dedupe/orm/active_record.rb', line 13

def duplicates
  klass, scope_name = self.class, self.class.dedupe_scope_name
  raise MissingScope unless klass.respond_to? scope_name 
  result_set = klass.send scope_name, self 
  raise InvalidScope unless result_set.is_a? ::ActiveRecord::Relation
  result_set.excluding self 
end