method

scope_relation

scope_relation(record, table, relation)
protected

No documentation available.

# File activerecord/lib/active_record/validations/uniqueness.rb, line 86
      def scope_relation(record, table, relation)
        Array(options[:scope]).each do |scope_item|
          if reflection = record.class._reflect_on_association(scope_item)
            scope_value = record.send(reflection.foreign_key)
            scope_item  = reflection.foreign_key
          else
            scope_value = record._read_attribute(scope_item)
          end
          relation = relation.and(table[scope_item].eq(scope_value))
        end

        relation
      end