- 06 11月, 2018 1 次提交
-
-
由 Eugene Kenny 提交于
The `read_attribute` method always returns the primary key when asked to read the `id` attribute, even if the primary key isn't named `id`, and even if another attribute named `id` exists. For the `inspect`, `attribute_for_inspect` and `pretty_print` methods, this behaviour is undesirable, as they're used to examine the internal state of the record. By using `_read_attribute` instead, we'll get the real value of the `id` attribute.
-
- 26 9月, 2018 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 07 6月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
Follow up of #32952.
-
- 28 5月, 2018 1 次提交
-
-
由 Santosh Wadghule 提交于
- Fixes #32940
-
- 27 5月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
Since #31405, using `#increment!` with touch option instead of `#touch` to touch belongs_to association if counter cache is enabled. It caused the regression since `#increment!` won't invoke after_touch callbacks even if touch option is given. To fix the regression, make `#increment!` invokes after_touch callbacks if touch option is given. Fixes #31559. Fixes #32408.
-
- 11 5月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
`becomes` creates new object and copies attributes from the receiver. If new object has mutation tracker which is created in `after_initialize`, it should be cleared since it is for discarded attributes. But if the receiver doesn't have mutation tracker yet, it will not be cleared properly. It should be cleared regardless of whether the receiver has mutation tracker or not. Fixes #32867.
-
- 30 3月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
-
- 27 3月, 2018 1 次提交
-
-
由 Ryuta Kamizono 提交于
The receiver in a scope was changed from `klass` to `relation` itself for all scopes (named scope, default_scope, and association scope) behaves consistently. In addition. Before 5.2, if both an AR model class and a Relation instance have same named methods (e.g. `arel_attribute`, `predicate_builder`, etc), named scope doesn't respect relation instance information. For example: ```ruby class Post < ActiveRecord::Base has_many :comments1, class_name: "RecentComment1" has_many :comments2, class_name: "RecentComment2" end class RecentComment1 < ActiveRecord::Base self.table_name = "comments" default_scope { where(arel_attribute(:created_at).gteq(2.weeks.ago)) } end class RecentComment2 < ActiveRecord::Base self.table_name = "comments" default_scope { recent_updated } scope :recent_updated, -> { where(arel_attribute(:updated_at).gteq(2.weeks.ago)) } end ``` If eager loading `Post.eager_load(:comments1, :comments2).to_a`, `:comments1` (default_scope) respects aliased table name, but `:comments2` (using named scope) may not work correctly since named scope doesn't respect relation instance information. See also 801ccab2. But this is a breaking change between releases without deprecation. I decided to bring back private class methods accessibility in named scope. Fixes #31740. Fixes #32331.
-
- 22 12月, 2017 1 次提交
-
-
由 Mike Busch 提交于
update_attribute previously stopped execution, before saving and before running callbacks, if the record's attributes hadn't changed. [The documentation](http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-update_attribute) says that "Callbacks are invoked", which was not happening if the persisted attributes hadn't changed.
-
- 20 7月, 2017 1 次提交
-
-
由 Kir Shatrov 提交于
-
- 02 7月, 2017 1 次提交
-
-
由 Matthew Draper 提交于
This reverts commit 3420a145, reversing changes made to afb66a5a.
-
- 01 7月, 2017 1 次提交
-
-
由 Kir Shatrov 提交于
-
- 24 5月, 2017 1 次提交
-
-
由 Ryuta Kamizono 提交于
-
- 23 12月, 2016 1 次提交
-
-
由 Akira Matsuda 提交于
-
- 08 8月, 2016 1 次提交
-
-
由 Xavier Noria 提交于
A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required.
-
- 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.
-
- 20 7月, 2016 1 次提交
-
-
由 Yasuo Honda 提交于
- Refer https://github.com/rsim/oracle-enhanced/pull/845 Remove `set_date_columns` which has been deprecated in Oracle enhanced adapter - Refer https://github.com/rsim/oracle-enhanced/pull/869
-
- 06 9月, 2015 1 次提交
-
-
由 Wojciech Wnętrzak 提交于
-
- 22 7月, 2015 1 次提交
-
-
由 Mehmet Emin İNAÇ 提交于
-
- 26 11月, 2013 1 次提交
-
-
由 heruku 提交于
-
- 11 9月, 2013 1 次提交
-
-
由 Akira Matsuda 提交于
-
- 18 8月, 2013 1 次提交
-
- 25 7月, 2013 1 次提交
-
-
由 Akira Matsuda 提交于
-
- 24 1月, 2013 3 次提交
-
-
由 Akira Matsuda 提交于
-
由 Akira Matsuda 提交于
This reverts commit 4e05bfb8. Reason: BlankTopic#blank? should not be removed to check that dynamic finder with a bang can find a model that responds to `blank?`
-
由 Akira Matsuda 提交于
-
- 13 11月, 2012 1 次提交
-
-
由 Nikita Afanasenko 提交于
-
- 05 11月, 2012 1 次提交
-
-
由 Yves Senn 提交于
-
- 28 7月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders.
-
- 22 6月, 2012 1 次提交
-
-
由 Maximilian Schneider 提交于
previously dynamic finders only worked in combination with the actual column name and not its alias defined with #alias_attribute
-
- 27 4月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
-
- 26 4月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
-
- 25 4月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
-
- 22 3月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
Don't use this: scope :red, where(color: 'red') default_scope where(color: 'red') Use this: scope :red, -> { where(color: 'red') } default_scope { where(color: 'red') } The former has numerous issues. It is a common newbie gotcha to do the following: scope :recent, where(published_at: Time.now - 2.weeks) Or a more subtle variant: scope :recent, -> { where(published_at: Time.now - 2.weeks) } scope :recent_red, recent.where(color: 'red') Eager scopes are also very complex to implement within Active Record, and there are still bugs. For example, the following does not do what you expect: scope :remove_conditions, except(:where) where(...).remove_conditions # => still has conditions
-
- 07 1月, 2012 1 次提交
-
-
由 Bogdan Gusiev 提交于
-
- 24 12月, 2011 1 次提交
-
-
由 Alvaro Bautista 提交于
-
- 17 12月, 2011 1 次提交
-
-
由 Sergey Nartimov 提交于
-
- 13 9月, 2011 1 次提交
-
-
由 Jon Leighton 提交于
-
- 18 4月, 2011 1 次提交
-
-
由 Jon Leighton 提交于
Revert "Deprecate defining scopes with a callable (lambda, proc, etc) via the scope class method. Just define a class method yourself instead." This reverts commit f0e198bf. Conflicts: activerecord/test/models/post.rb
-