method

scope_relation

Importance_0
scope_relation(record, relation) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/validations/uniqueness.rb, line 85
      def scope_relation(record, relation)
        Array(options[:scope]).each do |scope_item|
          scope_value = if record.class._reflect_on_association(scope_item)
            record.association(scope_item).reader
          else
            record.read_attribute(scope_item)
          end
          relation = relation.where(scope_item => scope_value)
        end

        relation
      end
Register or log in to add new notes.