| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Autosave association doesn't save all records on a new record for a collection association if there are records marked for destruction
|
| |
| |
| |
| | |
destroy record in autosave collection.
|
|/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Avoid double hash lookups in AR::Reflection when reflecting associations/aggregations
* Minor cleanups: use elsif, do..end, if..else instead of unless..else
* Simplify DynamicMatchers#respond_to?
* Use "where" instead of scoped with conditions hash
* Extract `scoped_by` method pattern regexp to constant
* Extract noisy class_eval from method_missing in dynamic matchers
* Extract readonly check, avoid calling column#to_s twice in persistence
* Refactor predicate builder, remove some variables
|
|
|
| |
Reverts a part of 91148936f770dc8bbbb33d46a09528f1a32d8a71. Should probably be squashed with it when merging back in rails/rails.
|
|
|
|
| |
* Fix typos
* Remove meaningless code from the examples
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
E.G.:
```ruby
class Parent < ActiveRecord::Base
has_one :child
validates_presence_of :name, :on => "custom_context"
validates_associated :child
end
class Child < ActiveRecord::Base
belongs_to :parent
validates_presence_of :name, :on => "custom_context"
end
p = Parent.new(:name => "Montoto", :child => Child.new)
p.valid?(:custom_context) # => Returns true, even though the child is not valid under the same context.
```
|
| |
|
| |
|
| |
|
|
|
|
| |
Asssigning a parent id to a belongs_to association actually updates the object that is validated when the association has :validates => true
|
|
|
|
|
|
|
|
|
| |
Previously we would just silently write the attribute. This can lead to
subtle bugs (for example, see the change in AutosaveAssociation where a
through association would wrongly gain an attribute.
Also, ensuring that we never gain any new attributes after
initialization will allow me to reduce our dependence on method_missing.
|
|
|
|
| |
performance gain for cases where the association is never used to load the target, for example with preloading. Related: #1873.
|
| |
|
| |
|
|
|
|
| |
callbacks etc) rather than calling a whole bunch of methods with rather long names.
|
|\
| |
| |
| |
| |
| | |
Conflicts:
activerecord/lib/active_record/associations/association.rb
activerecord/lib/active_record/fixtures.rb
|
| |
| |
| |
| | |
manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
activerecord/examples/performance.rb
activerecord/lib/active_record/association_preload.rb
activerecord/lib/active_record/associations.rb
activerecord/lib/active_record/associations/association_proxy.rb
activerecord/lib/active_record/autosave_association.rb
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/nested_attributes.rb
activerecord/test/cases/relations_test.rb
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
state:resolved]
This required changing the code to keep the association proxy for a belongs_to around, despite its target being nil. Which in turn required various changes to the way that stale target checking is handled, in order to support various edge cases (loaded target is nil then foreign key added, foreign key is changed and then changed back, etc). A side effect is that the code is nicer and more succinct.
Note that I am removing test_no_unexpected_aliasing since that is basically checking that the proxy for a belongs_to *does* change, which is the exact opposite of the intention of this commit. Also adding various tests for various edge cases and related things.
Phew, long commit message!
|
| |
| |
| |
| | |
options key which it relates to is :foreign_key
|
| | |
|
|\|
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
activerecord/lib/active_record/associations/association_proxy.rb
activerecord/lib/active_record/autosave_association.rb
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/persistence.rb
|
| |
| |
| |
| |
| |
| | |
nested associations have changed (resolves #3353)
Signed-off-by: José Valim <jose.valim@gmail.com>
|
| | |
|
| | |
|
| |
| |
| |
| | |
exception.
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
| |
- persisted? is the API defined in ActiveModel
- makes it easier for extension libraries to conform to ActiveModel APIs
without concern for whether the extended object is specifically
ActiveRecord
[#5927 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
|
|
|
|
| |
etc with just a single scope hash (created on initialization of the proxy). This is now used consistently across all associations. Therefore, all you have to do to ensure finding/counting etc is done correctly is implement the scope correctly.
|
|
|
|
|
| |
This way parent models can get their own after_create and
after_update callbacks fired after has_one has done its job.
|
|
|
|
| |
's/[ \t]*$//' -i {} \;)
|
|
|
|
| |
This will hopefully make Active Record run a bit more faster.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Signed-off-by: José Valim <jose.valim@gmail.com>
|
|
|
|
|
|
|
|
| |
[#3353 state:open]"
Please check Lighthouse for more information.
This reverts commit 4a0d7c1a439c6ad8d35bf514761824e51fa07df2.
|
|
|
|
|
|
| |
state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
|
|
|
|
| |
Signed-off-by: José Valim <jose.valim@gmail.com>
|
| |
|
| |
|
|
|
|
| |
[#4648 state:resolved]
|