aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/counter_cache_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Updates reset_counters to allow counter name in paramsJason Normore2014-05-161-3/+13
| | | | | | | Add support for counter name to be passed as parameter on `CounterCache::ClassMethods#reset_counters`. This is to be consistent with the other methods in the module that all accept counter name.
* Refactor AR's counter_cache_test.rb testTakehiro Adachi2013-05-231-8/+3
|
* Add test for AR::CounterCache.update_countersTakehiro Adachi2013-05-231-0/+6
|
* Add test to AR's counter_cache_test.rbTakehiro Adachi2013-05-181-0/+12
| | | | | | | According to https://github.com/rails/rails/blob/b601399b72ab56cc01368f02615af99f45d1 4f02/activerecord/lib/active_record/counter_cache.rb#L14, u can pass more then one association to the `reset_counters` method.
* squelch an unused variable warningAaron Patterson2013-03-221-0/+1
|
* Update other counter caches on destroyIan Young2013-03-201-0/+8
|
* Refactor Person/Friendship relationships to be more intuitiveMack Earnhardt2013-03-171-1/+1
| | | | | | | | PR #5210 added a Friendship model to illustrate a bug, but in doing so created a confusing structure because both belongs_to declarations in Friendship referred to the same side of the join. The new structure maintains the integrity of the bug test while changing the follower relationship to be more useful for other testing.
* `#reset_counters` verifies counter names.Yves Senn2013-03-151-0/+7
| | | | | | | Closes #9724. Raise an `ArgumentError` when the name of the counter does not match an association name.
* Fix reset_counters() crashing on has_many :through associations.lulalala2012-10-021-1/+14
| | | | | The counter column name in the intermediate model need to be access via the through reflection.
* reset_counters() was crashing when there were multiple belongs_to ↵Dave Desrochers2012-08-211-1/+10
| | | | | | associations with the same foreign key. This closes #5200.
* Fix bug where reset_counters resets the wrong counter cache.David Peter2012-01-161-2/+18
| | | | | | | | If a model belongs_to two associations with the same class, then reset_counters will reset the wrong counter cache. Finding the right reflection should use the foreign_key instead, which should be unique.
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-1/+1
| | | | 's/[ \t]*$//' -i {} \;)
* reset_counter should work with non-traditional belongs_to and polymorphic ↵Neeraj Singh2010-07-081-3/+16
| | | | | | | | belongs_to [#4984 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* remove executable permission from files that don't need it. [#4802 ↵rohit2010-06-201-0/+0
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* fix `reset_counters` to work even with complex class namesMislav Marohnić2010-05-241-0/+25
| | | | | | e.g. it guesses that a belongs_to association to Namespace::MyModel is named "my_model", unlike before where it would look up an association named "namespace::mymodel" and fail.
* move counter_cache tests to a separate file and refactorMislav Marohnić2010-05-241-0/+58