aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/singular_association.rb
Commit message (Collapse)AuthorAgeFilesLines
* default scopes should break the cache on singulur_association.alfa-jpn2014-11-081-1/+2
| | | | fixes #17495
* break cache if we're inside a "scoping" call. fixes #17052Aaron Patterson2014-10-141-1/+6
| | | | | For now, we don't want to take "scoping" calls in to account when calculating cache keys for relations, so just opt-out.
* Skip StatementCache for eager loaded associations (Fixes #16761)Sammy Larbi2014-09-041-1/+1
| | | | | | Eagerly loaded collection and singular associations are ignored by the StatementCache, which causes errors when the queries they generate reference columns that were not eagerly loaded. This commit skips the creation of the StatementCache as a fix for these scenarios.
* use statement cache for belongs_to relationsAaron Patterson2014-04-221-1/+12
|
* extract record fetching to a method for belongs_toAaron Patterson2014-04-221-1/+5
|
* [Active Record] Renamed private methods create_record and update_recordPrathamesh Sonpatki2014-02-201-3/+3
| | | | | | This is to ensure that they are not accidentally called by the app code. They are renamed to _create_record and _update_record respectively. Closes #11645
* `has_one` and `belongs_to` accessors don't add ORDER BY to the queries anymore.Rafael Mendonça França2014-01-211-1/+1
| | | | | | | | | | Since Rails 4.0, we add an ORDER BY in the `first` method to ensure consistent results among different database engines. But for singular associations this behavior is not needed since we will have one record to return. As this ORDER BY option can lead some performance issues we are removing it for singular associations accessors. Fixes #12623.
* remove the nil check from set_inverse_instanceAaron Patterson2013-12-121-1/+3
| | | | | methods that call set_inverse_instance with a record will not have to pay the cost of a nil check on every call
* Remove useless comment and white spaces :scissors: [ci skip]Carlos Antonio da Silva2013-09-011-1/+0
|
* This is comment for singular association.kennyj2012-11-021-1/+1
|
* Remove mass_assignment_options from ActiveRecordGuillermo Iguaran2012-09-161-8/+8
|
* s/scoped/scope/Jon Leighton2012-08-011-2/+2
|
* Ensure that the foreign key gets set when doing record.create_association or ↵Jon Leighton2011-07-081-2/+11
| | | | record.create_association. Fixes #1960.
* Assign the association attributes to the associated record before the ↵Jon Leighton2011-06-301-2/+1
| | | | before_initialize callback of the record runs. Fixes #1842.
* Don't pass a block as we are yieldingAndrew White2011-05-171-1/+1
|
* Add block setting of attributes to singular associationsAndrew White2011-05-171-5/+6
|
* Pass the attribute and option hashes to build_associationAndrew White2011-05-171-6/+6
| | | | | | | The build_association method was added as an API for plugins to hook into in 1398db0. This commit restores this API and the ability to override class.new to return a subclass based on a virtual attribute in the attributes hash.
* Don't use mass-assignment protection when setting foreign keys or ↵Jon Leighton2011-05-121-9/+9
| | | | association conditions on singular associations. Fixes #481 (again).
* singular and collection relations in AR can now specify mass-assignment ↵Josh Kalderimis2011-05-011-8/+8
| | | | security options (:as and :without_protection) in build, create and create! methods.
* Add additional text to NotImplementedErrors [#6328 state:resolved]Mike Gehard2011-03-121-1/+1
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Use proper objects to do the work to build the associations (adding methods, ↵Jon Leighton2011-02-211-0/+16
| | | | callbacks etc) rather than calling a whole bunch of methods with rather long names.
* Singular associations no longer use a proxy, so no need to check for the ↵Jon Leighton2011-02-211-6/+0
| | | | proxy type on assignment.
* Associations - where possible, call attributes methods rather than directly ↵Jon Leighton2011-02-211-1/+1
| | | | accessing the instance variables
* Split AssociationProxy into an Association class (and subclasses) which ↵Jon Leighton2011-02-181-2/+2
| | | | manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more.
* Let's be less blasé about method visibility on association proxiesJon Leighton2011-01-301-0/+1
|
* We shouldn't be using scoped.scoping { ... } to build associated records, as ↵Jon Leighton2011-01-301-6/+9
| | | | this can affect validations/callbacks/etc inside the record itself [#6252 state:resolved]
* find_target can also go into SingularAssociationJon Leighton2011-01-161-0/+4
|
* Abstract a bit more into SingularAssociationJon Leighton2011-01-161-0/+6
|
* Abstract common code from BelongsToAssociation and HasOneAssociation into ↵Jon Leighton2011-01-161-0/+31
SingularAssociation