Sha256: 4b11473acd7d142fe741f95c0350d807118028b7032b2ddb723cb6b03e8e816b
Contents?: true
Size: 503 Bytes
Versions: 2
Compression:
Stored size: 503 Bytes
Contents
require File.expand_path('../abstract_unit', __FILE__) class TestUpdateAll < ActiveSupport::TestCase fixtures :articles, :users def test_update_all first_article = Article.first users_count = first_article.users.count # limit forces a subquery first_article.users.limit(1).update_all(name: 'test') assert_equal( User.joins(readings: :article) .merge(Article.where(id: first_article)) .where(name: 'test').count, users_count ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
composite_primary_keys-8.1.8 | test/test_update_all.rb |
composite_primary_keys-8.1.7 | test/test_update_all.rb |