Flowdock
delete_records(records) protected

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/associations/has_and_belongs_to_many_association.rb, line 82
        def delete_records(records)
          if sql = @reflection.options[:delete_sql]
            records.each { |record| @owner.connection.delete(interpolate_and_sanitize_sql(sql, record)) }
          else
            relation = Arel::Table.new(@reflection.options[:join_table])
            relation.where(relation[@reflection.primary_key_name].eq(@owner.id).
              and(relation[@reflection.association_foreign_key].in(records.map { |x| x.id }.compact))
            ).delete
          end
        end
Register or log in to add new notes.