- 17 7月, 2015 1 次提交
-
-
由 Prem Sichanugrist 提交于
We deprecate the support for passing an argument to force reload in 6eae366d. That led to several deprecation warning when running Active Record test suite. This commit silence the warnings by properly calling `#reload` on the association proxy or on the association object instead. However, there are several places that `ActiveSupport::Deprecation.silence` are used as those tests actually tests the force reload functionality and will be removed once `master` is targeted next minor release (5.1).
-
- 16 7月, 2015 1 次提交
-
-
由 Prem Sichanugrist 提交于
This is to simplify the association API, as you can call `reload` on the association proxy or the parent object to get the same result. For collection association, you can call `#reload` on association proxy to force a reload: @user.posts.reload # Instead of @user.posts(true) For singular association, you can call `#reload` on the parent object to clear its association cache then call the association method: @user.reload.profile # Instead of @user.profile(true) Passing a truthy argument to force association to reload will be removed in Rails 5.1.
-
- 02 5月, 2015 1 次提交
-
-
由 Yuki Nishijima 提交于
When `AR::Base.save!` or `AR::Base.destroy!` is called and an exception is raised, the exception doesn't have any error message or has a weird message like `#<FailedBulb:0x0000000907b4b8>`. Give a better message so we can easily understand why it's failing to save/destroy.
-
- 21 4月, 2015 1 次提交
-
-
由 Andrew White 提交于
In 1f006c an option was added called :class to allow passing anonymous classes to association definitions. Since using :class instead of :class_name is a fairly common typo even amongst experienced developers this can result in hard to debug errors arising in raise_on_type_mismatch? To fix this we're renaming the option from :class to :anonymous_class as that is a more correct description of what the option is for. Since this was an internal, undocumented option there is no need for a deprecation. Fixes #19659
-
- 04 4月, 2015 1 次提交
-
-
由 Shintaro Kojima 提交于
When replacing a has_many association with the same one, there is nothing to do with database but a setter method should still return the substituted value for backward compatibility.
-
- 16 3月, 2015 1 次提交
-
-
由 Ben Woosley 提交于
When a new record has the necessary information prior to save, we can avoid busting the cache. We could simply clear the @proxy on #reset or #reset_scope, but that would clear the cache more often than necessary.
-
- 28 2月, 2015 1 次提交
-
-
由 Akira Matsuda 提交于
-
- 21 2月, 2015 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 13 2月, 2015 1 次提交
-
-
由 Eugene Gilburg 提交于
Use SQL COUNT and LIMIT 1 queries for none? and one? methods if no block or limit is given, instead of loading the entire collection to memory. The any? and many? methods already follow this behavior. [Eugene Gilburg & Rafael Mendonça França]
-
- 28 1月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
The only place it was accessed was in tests. Many of them have another way that they can test their behavior, that doesn't involve reaching into internals as far as they did. `AssociationScopeTest` is testing a situation where the where clause would have one bind param per predicate, so it can just ignore the predicates entirely. The where chain test was primarly duplicating the logic tested on `WhereClause` directly, so I instead just make sure it calls the appropriate method which is fully tested in isolation.
-
- 26 1月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
-
- 16 1月, 2015 1 次提交
-
-
由 brainopia 提交于
after_commit callbacks run after committing a transaction whose parent is not `joinable?`: un-nested transactions, transactions within test cases, and transactions in `console --sandbox`.
-
- 31 12月, 2014 1 次提交
-
-
由 brainopia 提交于
-
- 09 12月, 2014 1 次提交
-
-
To be possible to use a custom column name to save/read the polymorphic associated type in a has_many or has_one polymorphic association, now users can use the option :foreign_type to inform in what column the associated object type will be saved.
-
- 29 11月, 2014 1 次提交
-
-
由 Erik Michaels-Ober 提交于
-
- 28 11月, 2014 1 次提交
-
-
由 Yuki Nishijima 提交于
Since 3e30c5d4, it started ignoring the given error message. This commit changes the behavior of AR::RecordNotSaved#initialize so that it no longer loses the given error message.
-
- 26 11月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
The records weren't being replaced since equality in Active Record is defined in terms of `id` only. It is reasonable to expect that the references would be replaced in memory, even if no queries are actually executed. This change did not appear to affect any other parts of the code base. I chose not to execute callbacks since we're not actually modifying the association in a way that will be persisted. Fixes #17730
-
- 14 11月, 2014 1 次提交
-
-
由 Arun Agrawal 提交于
`Computer` class needs to be require See #17217 for more details
-
- 08 11月, 2014 1 次提交
-
-
由 Aaron Patterson 提交于
if you specify a default scope on a model, it will break caching. We cannot predict what will happen inside the scope, so play it safe for now. fixes #17495
-
- 30 10月, 2014 1 次提交
-
-
由 Tu Hoang 提交于
There are behaviors mentioned in #17161 that: 1. are not documented properly, and 2. don't have specs This commit addresses the spec absence. For has_many collections, 1. addition (<<) should update the associated object's updated_at (if any) 2. .clear, depending on options[:dependent], calls delete_all, destroy_all, or nullifies the associated object(s)' foreign key.
-
- 23 10月, 2014 1 次提交
-
-
由 Byron Bischoff 提交于
-
- 03 10月, 2014 1 次提交
-
-
由 Ben Woosley 提交于
Fix that a collection proxy could be cached before the save of the owner, resulting in an invalid proxy lacking the owner’s id. Absent this fix calls like: owner.association.update_all to behave unexpectedly because they try to act on association objects where owner_id is null. more evidence here: https://gist.github.com/Empact/5865555 ``` Active Record 3.2.13 -- create_table(:firms, {:force=>true}) -> 0.1371s -- create_table(:clients, {:force=>true}) -> 0.0005s 1 clients. 1 expected. 1 clients updated. 1 expected. ``` ``` Active Record 4.0.0 -- create_table(:firms, {:force=>true}) -> 0.1606s -- create_table(:clients, {:force=>true}) -> 0.0004s 1 clients. 1 expected. 0 clients updated. 1 expected. ```
-
- 06 9月, 2014 1 次提交
-
-
由 Rafael Mendonça França 提交于
Callback order in Active Record objects are important. Users should not define callbacks before the association definition or surprising behaviours like the described at #3798 will happen. This callback order dependency is documented at https://github.com/rails/rails/blob/31bfcdc77ca0d8cec9b5fe513bdc6f05814dd4f1/activerecord/lib/active_record/associations.rb#L1222-1227. This reverts #15728. Fixes #16620.
-
- 28 8月, 2014 1 次提交
-
-
由 Akira Matsuda 提交于
-
- 26 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
Reliant on https://github.com/rails/rails/pull/15747 but pulled to a separate PR to reduce noise. `has_many :through` associations have the undocumented behavior of automatically detecting counter caches. However, the way in which it does so is inconsistent with counter caches everywhere else, and doesn't actually work consistently. As with normal `has_many` associations, the user should specify the counter cache on the `belongs_to`, if they'd like it updated.
-
- 16 6月, 2014 1 次提交
-
-
由 Sean Griffin 提交于
Before, calling `size` would only work if it skipped the cache, and would return a different result from the cache, but only if: - The association was previously loaded - Or you called size previously - But only if the size was 0 when you called it This ensures that the counter is appropriately updated in memory.
-
- 10 6月, 2014 1 次提交
-
-
由 David Verhasselt 提交于
-
- 10 5月, 2014 1 次提交
-
-
由 Yves Senn 提交于
-
- 04 5月, 2014 2 次提交
-
-
由 Carlos Antonio da Silva 提交于
-
由 Carlos Antonio da Silva 提交于
Only care about its truthiness rather than asserting specific true/false values. If we need to check for the return value in particular, there will be a test for that.
-
- 03 5月, 2014 1 次提交
-
-
由 Aaron Patterson 提交于
bind parameters we not being propogated to simple subquery calculation calls. This fixes it
-
- 01 5月, 2014 1 次提交
-
-
由 Eric Chahin 提交于
associations were not being saved. Fixes #13854. [Eric Chahin, Aaron Nelson, & Kevin Casey]
-
- 29 4月, 2014 1 次提交
-
-
由 eileencodes 提交于
Test checks that SQL is the same for a loaded vs not loaded association (category.categorizations, category.categorization.delete_all vs category.cartegroization.delete_al). This was fixed for delete_all dependency but was not fixed for no (:nullify, or nil) dependency).
-
- 04 4月, 2014 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 03 4月, 2014 1 次提交
-
-
由 Lauro Caetano 提交于
It was causing error when using `with_options` passing a lambda as its last argument. class User < ActiveRecord::Base with_options dependent: :destroy do |assoc| assoc.has_many :profiles, -> { where(active: true) } end end It was happening because the `option_merger` was taking the last argument and checking if it was a Hash. This breaks the HasMany usage, because its last argument can be a Hash or a Proc. As the behavior described in this test: https://github.com/rails/rails/blob/master/activesupport/test/option_merger_test.rb#L69 the method will only accept the lambda, this way it will keep the expected behavior. See 9eaa0a34
-
- 01 4月, 2014 1 次提交
-
-
由 eileencodes 提交于
delete_all sql if an association is not loaded should behave the same as if the association is loaded. This test ensures the SQL statements are exactly the same.
-
- 01 3月, 2014 1 次提交
-
-
由 Arthur Neves 提交于
When replacing a has_many association with the same one, there is no need to do a round-trip to the db to create/and drop a new transaction. [fixes #14220]
-
- 21 2月, 2014 1 次提交
-
-
由 Aaron Patterson 提交于
This reverts commit 5e3d466d.
-
- 09 2月, 2014 1 次提交
-
-
由 Kevin Casey 提交于
-
- 31 1月, 2014 1 次提交
-
-
由 Lauro Caetano 提交于
Dangerous association names conflicts include instance or class methods already defined by `ActiveRecord::Base`.
-