- 06 3月, 2018 1 次提交
-
-
由 Fernando Gorodscy 提交于
When a class has a belongs_to or has_one relationship with dependent: :destroy option enabled, objects of this class should not be deleted if it's dependents cannot be deleted. Example: class Parent has_one :child, dependent: :destroy end class Child belongs_to :parent, inverse_of: :child before_destroy { throw :abort } end c = Child.create p = Parent.create(child: c) p.destroy p.destroyed? # expected: false; actual: true; Fixes #32022
-
- 26 1月, 2018 1 次提交
-
-
由 Daniel Colson 提交于
-
- 25 7月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
``` % ARCONN=sqlite3 be ruby -w -Itest test/cases/associations/belongs_to_associations_test.rb -n test_multiple_counter_cache_with_after_create_update test/cases/associations/belongs_to_associations_test.rb:1181: warning: assigned but unused variable - comment Using sqlite3 Run options: -n test_multiple_counter_cache_with_after_create_update --seed 49644 . Finished in 0.114266s, 8.7515 runs/s, 17.5030 assertions/s. 1 runs, 2 assertions, 0 failures, 0 errors, 0 skips ```
-
- 21 7月, 2017 1 次提交
-
-
由 yuuji.yaginuma 提交于
This fixes the following failures. https://travis-ci.org/rails/rails/jobs/253990014
-
- 20 7月, 2017 1 次提交
-
-
由 Kir Shatrov 提交于
-
- 19 7月, 2017 1 次提交
-
-
由 Lisa Ugray 提交于
When an `after_create` callback did `update_attributes` on a record with multiple `belongs_to` associations with counter caches, even numbered associations would have their counters double-incremented. Fixes to `ActiveModel::Dirty` in 020abadf fixed this. This adds regression tests for this bug fixed incidentally in the other commit, which also removed the need for the workaround using @_after_create_counter_called.
-
- 16 7月, 2017 1 次提交
-
-
由 yuuji.yaginuma 提交于
This fixes the following failures. https://travis-ci.org/rails/rails/jobs/253990014
-
- 13 7月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
Since 07e5301e, `Relation#first` will order by primary key if no order is defined.
-
- 02 7月, 2017 1 次提交
-
-
由 Matthew Draper 提交于
This reverts commit 3420a145, reversing changes made to afb66a5a.
-
- 01 7月, 2017 1 次提交
-
-
由 Kir Shatrov 提交于
-
- 29 6月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
`aliased_table_name` in `Association` was added at a3502c41. `aliased_table_name` in `JoinDependency` (added at 55854c41) is used, but it looks like that added one in `Association` is never used from the beginning.
-
- 28 4月, 2017 1 次提交
-
-
由 George Claghorn 提交于
-
- 17 3月, 2017 1 次提交
-
-
由 George Claghorn 提交于
Use it to specify that an association should be initialized with a particular record before validation. For example: # Before belongs_to :account before_validation -> { self.account ||= Current.account } # After belongs_to :account, default: -> { Current.account }
-
- 30 12月, 2016 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 25 12月, 2016 1 次提交
-
-
由 Akira Matsuda 提交于
-
- 10 12月, 2016 1 次提交
-
-
由 Ryuta Kamizono 提交于
-
- 22 11月, 2016 1 次提交
-
-
由 Yves Senn 提交于
This patch brings back the functionality of passing true to the association proxy. The behavior was deprecated with #20888 and scheduled for removal in Rails 5.1. The deprecation mentioned that instead of `Article.category(true)` one should use `article#reload.category`. Unfortunately the alternative does not expose the same behavior as passing true to the reader did. Specifically reloading the parent record throws unsaved changes and other caches away. Passing true only affected the association. This is problematic and there is no easy workaround. I propose to bring back the old functionality by introducing this new reader method for singular associations.
-
- 29 10月, 2016 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 10 10月, 2016 1 次提交
-
-
由 Ryuta Kamizono 提交于
Currently to access `belongs_to` associations raises a `RangeError` if foreign key attribute has out of range value. It should return a nil value rather than raising a `RangeError`. Fixes #20140.
-
- 26 8月, 2016 1 次提交
-
-
由 James Coleman 提交于
Previously, if the the association was previously loaded and then the foreign key changed by itself, a #save call would trigger a load of the new associated record during autosave. This is unnecessary and the autosave code (in that case) didn't use the loaded record anyways.
-
- 16 8月, 2016 1 次提交
-
-
由 Rafael Mendonça França 提交于
Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
-
- 07 8月, 2016 2 次提交
-
-
由 Xavier Noria 提交于
-
由 Xavier Noria 提交于
The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
-
- 13 5月, 2016 1 次提交
-
-
由 Sean Griffin 提交于
The error message that we give today makes this error difficult to debug if you receive it. I have no clue why we're printing the object ID of the class (the commit doesn't give context), but I've left it as it was deliberate.
-
- 29 4月, 2016 1 次提交
-
-
由 Tom Kadwill 提交于
-
- 02 3月, 2016 1 次提交
-
-
由 Ryuta Kamizono 提交于
-
- 17 12月, 2015 1 次提交
-
-
由 Abdelkader Boudih 提交于
-
- 23 9月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
When I originally reviewed the #20317, I believe these changes were present, but it appears that it was later updated so that they were removed. Since Travis hadn't re-run the build, this slipped through.
-
- 27 8月, 2015 1 次提交
-
-
由 Ronak Jangir 提交于
-
- 13 8月, 2015 1 次提交
-
-
由 Yves Senn 提交于
As described in the "Follow Coding Conventions" section in our contribution guide (http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions) we favor `assert_not` over `refute`. While we don't usually make stylistic changes on it's own I opted to do it in this case. The reason being that test cases are usually copied as a starting point for new tests. This results in a spread of `refute` in files that have been using it already.
-
- 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.
-
- 22 6月, 2015 1 次提交
-
-
由 Diego Carrion 提交于
thrown ActiveRecord::AssociationTypeMismatch when assigning a wrong value for a namespaced association fixes #20541
-
- 17 6月, 2015 1 次提交
-
-
由 Diego Carrion 提交于
raise ActiveModel::MissingAttributeError when trying to access a relationship without the foreign key attribute fixes regression reported on #20253 ActiveRecord::Base#[] was not used cause of 8b954200
-
- 14 6月, 2015 1 次提交
-
-
由 James Dabbs 提交于
Unitialized polymorphic `belongs_to` associations raise an error while attempting to reload, as they attempt to make an uncached reload, but don't have a klass to fetch uncachedly. In this case, `loaded?` should be `false` anyway.
-
- 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
-
- 09 4月, 2015 2 次提交
-
-
由 Tristan Gamilis 提交于
Assert that counter_cache behaviour is not used on belongs_to or has_many associations if the option is not given explicitly.
-
由 Arthur Neves 提交于
[fixes #18606] Make belongs_to use touch over touch_later when running the callbacks. Add more tests and small method rename Thanks Jeremy for the feedback.
-
- 22 2月, 2015 1 次提交
-
-
由 Josef Šimánek 提交于
Deprecate `required` option in favor of `optional` for belongs_to.
-
- 27 1月, 2015 1 次提交
-
-
由 Sean Griffin 提交于
-