- 10 6月, 2014 1 次提交
-
-
由 eileencodes 提交于
Instead of checking for `macro == :has_one` throughout the codebase we can create a `has_one?` method to match the `belongs_to?`, `polymorphic?` and other methods.
-
- 25 5月, 2014 1 次提交
-
-
由 Arthur Neves 提交于
Fix habtm reflection Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/counter_cache.rb activerecord/lib/active_record/reflection.rb activerecord/test/cases/reflection_test.rb
-
- 21 2月, 2014 1 次提交
-
-
由 Wojtek Kruszewski 提交于
-
- 15 2月, 2014 2 次提交
-
-
由 Aaron Patterson 提交于
AssociationScope no longer maintains state, so we're safe to keep a singleton and save on GC time
-
由 Aaron Patterson 提交于
-
- 13 12月, 2013 1 次提交
-
-
由 Aaron Patterson 提交于
methods that call set_inverse_instance with a record will not have to pay the cost of a nil check on every call
-
- 07 12月, 2013 1 次提交
-
-
由 Scott M 提交于
-
- 17 11月, 2013 1 次提交
-
-
由 Edo Balvers 提交于
-
- 14 10月, 2013 2 次提交
-
-
由 Dmitry Polushkin 提交于
-
由 Dmitry Polushkin 提交于
check at association reader that record is inverted and should not be reloaded because of stale was changed at target record
-
- 03 10月, 2013 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 24 7月, 2013 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 02 7月, 2013 1 次提交
-
-
由 Neeraj Singh 提交于
-
- 28 6月, 2013 1 次提交
-
-
由 Jon Leighton 提交于
The previous implementation was necessary in order to support stuff like: class Post < ActiveRecord::Base default_scope where(published: true) scope :ordered, order("created_at") end If we didn't evaluate the default scope at the last possible moment before sending the SQL to the database, it would become impossible to do: Post.unscoped.ordered This is because the default scope would already be bound up in the "ordered" scope, and therefore wouldn't be removed by the "Post.unscoped" part. In 4.0, we have deprecated all "eager" forms of scopes. So now you must write: class Post < ActiveRecord::Base default_scope { where(published: true) } scope :ordered, -> { order("created_at") } end This prevents the default scope getting bound up inside the "ordered" scope, which means we can now have a simpler/better/more natural implementation of default scoping. A knock on effect is that some things that didn't work properly now do. For example it was previously impossible to use #except to remove a part of the default scope, since the default scope was evaluated after the call to #except.
-
- 23 5月, 2013 1 次提交
-
-
由 Neeraj Singh 提交于
-
- 10 5月, 2013 1 次提交
-
-
由 Jon Leighton 提交于
Suppose Man has_many interests, and inverse_of is used. Man.first.interests.first.man will correctly execute two queries, avoiding the need for a third query when Interest#man is called. This is because CollectionAssociation#first calls set_inverse_instance. However Man.first.interests.where("1=1").first.man will execute three queries, even though this is obviously a subset of the records in the association. This is because calling where("1=1") spawns a new Relation object from the CollectionProxy object, and the Relation has no knowledge of the association, so it cannot set the inverse instance. This commit solves the problem by making relations spawned from CollectionProxies return a new Relation subclass called AssociationRelation, which does know about associations. Records loaded from this class will get the inverse instance set properly. Fixes #5717. Live commit from La Conf!
✨
-
- 03 5月, 2013 1 次提交
-
-
由 Olek Janiszewski 提交于
For one-to-one nested associations, if you build the new (in-memory) child object yourself before assignment, then the NestedAttributes module will not overwrite it, e.g.: class Member < ActiveRecord::Base has_one :avatar accepts_nested_attributes_for :avatar def avatar super || build_avatar(width: 200) end end member = Member.new member.avatar_attributes = {icon: 'sad'} member.avatar.width # => 200
-
- 01 4月, 2013 1 次提交
-
-
由 Michal Cichra 提交于
This fixes inconsistency when building children of association which has inverse_of set properly. When creating new association object with a block: parent.association.build do |child| child.parent.equal?(parent) # false end So the block the `child.parent` did not point to the same object. But when the object is created it points to same instance: child = parent.association.build child.parent.equal?(parent) # true
-
- 30 3月, 2013 4 次提交
-
-
由 Neeraj Singh 提交于
-
由 Neeraj Singh 提交于
-
由 Neeraj Singh 提交于
-
由 Neeraj Singh 提交于
-
- 21 3月, 2013 1 次提交
-
-
由 wangjohn 提交于
-
- 26 2月, 2013 1 次提交
-
-
由 Akira Matsuda 提交于
-
- 22 11月, 2012 1 次提交
-
-
由 Yves Senn 提交于
Closes #8265
-
- 30 10月, 2012 1 次提交
-
-
由 Alexey Gaziev 提交于
-
- 29 10月, 2012 1 次提交
-
-
由 Nikita Afanasenko 提交于
It's sometimes hard to quickly find where deprecated call was performed, especially in case of migrating between Rails versions. So this is an attempt to improve the call stack part of the warning message by providing caller explicitly.
-
- 24 10月, 2012 1 次提交
-
-
由 Andrii Dovgaliuk 提交于
-
- 26 9月, 2012 1 次提交
-
-
由 Jeremy Kemper 提交于
Fix destructive side effects from marshaling an association caused by 65843e1a
-
- 17 9月, 2012 1 次提交
-
-
由 Guillermo Iguaran 提交于
-
- 06 8月, 2012 1 次提交
-
-
由 Xavier Noria 提交于
Selecting which key extensions to include in active_support/rails made apparent the systematic usage of Object#in? in the code base. After some discussion in https://github.com/rails/rails/commit/5ea6b0df9a36d033f21b52049426257a4637028d we decided to remove it and use plain Ruby, which seems enough for this particular idiom. In this commit the refactor has been made case by case. Sometimes include? is the natural alternative, others a simple || is the way you actually spell the condition in your head, others a case statement seems more appropriate. I have chosen the one I liked the most in each case.
-
- 03 8月, 2012 2 次提交
-
-
由 Xavier Noria 提交于
-
由 Xavier Noria 提交于
-
- 02 8月, 2012 2 次提交
-
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
This reverts commit 3803fcce. Conflicts: activerecord/CHANGELOG.md It will be deprecated only in 4.0, and removed properly in 4.1.
-
- 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.
-
- 21 7月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
-
- 13 7月, 2012 2 次提交
-
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
- 24 5月, 2012 1 次提交
-