aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
Commit message (Collapse)AuthorAgeFilesLines
* Improve doc of automatic inverse_of detectionFrançois D2019-03-081-2/+3
|
* Refs #28025 nullify *_type column on polymorphic associations on :nu… ↵Laerti2019-01-151-2/+4
| | | | | | (#28078) This PR addresses the issue described in #28025. On `dependent: :nullify` strategy only the foreign key of the relation is nullified. However on polymorphic associations the `*_type` column is not nullified leaving the record with a NULL `*_id` but the `*_type` column is present.
* Document exception from restrict_with_exception [ci skip]Malcolm Locke2018-10-291-2/+2
|
* Add missing rdoc +code+ tagsMatthew LS2018-09-261-1/+1
|
* Fix missing curly brace in documentationDavid Celis2018-09-201-0/+1
| | | This example was just missing a closing curly brace to complete the closure 😄
* Update associations.rb API documentation [ci skip] (#33857)Lucas Brandt2018-09-151-0/+1
| | | | | | | | | | | | | | * Update association_basics.md [ci skip] Addresses issue #33599 * Update associations.rb API documentation [ci skip] Additional detail for documentation of `belongs_to` `association=(associate)` * Update association_basics.md [ci skip] Reverts misplaced documentation comment
* [ci skip] Use consistent hash syntax in AR docsOrhan Toy2018-07-221-8/+8
| | | | | The examples with `.where` uses hash w/ symbol keys so it would be more consistent to also do this with `.new`. Also from my experience the hash w/ symbol keys is more widely used with `where/new/create` etc. in ActiveRecord.
* Fix `Associations::ClassMethods` doc [ci skip]Ryuta Kamizono2018-04-291-7/+7
| | | | | * Singular associations don't define `#association.nil?` * Wrap with <tt> for each method, not the whole sentence
* Fix broken nodocsChris Arcand2018-04-131-1/+1
| | | | | This commit fixes all references in the codebase missing a trailing :, which causes the nodoc not to actually work :) [skip ci]
* [ci skip] setting :inverse_of works with :as, :through and :polymorphic ↵Bart de Water2018-01-101-12/+18
| | | | | | | | options, and is needed for bi-directionality with a scope [ci skip] Remove :conditions opion from association basics guide This got replaced by scopes.
* Remove unused classesyuuji.yaginuma2017-11-031-30/+0
| | | | | | * `HasManyThroughCantDissociateNewRecords` and `HasManyThroughCantAssociateNewRecords` are no longer used since f6b12c1. * `ReadOnlyAssociation` is no longer used since 0da426b.
* [ci skip]Update the documentation about the primary key typesuginoy2017-10-291-3/+3
| | | | | | Replace the primary key type `integer` in docs with `bigint`. ref #26266
* Remove text about deprecation that was already removedRafael Mendonça França2017-10-231-2/+1
|
* Remove deprecated support to passing a class to `:class_name` on associationsRafael Mendonça França2017-10-231-2/+2
|
* [Active Record] require => require_relativeAkira Matsuda2017-10-211-1/+1
| | | | This basically reverts 9d4f79d3d394edb74fa2192e5d9ad7b09ce50c6d
* Remove association(true) references from docs [ci skip]Eugene Kenny2017-10-161-1/+1
| | | | | Passing `true` to force an association to reload its records from the database was deprecated in 5.0 and removed in 5.1.
* Remove the code that swapping `scope` and `options`Ryuta Kamizono2017-09-181-3/+3
| | | | `options` is never assigned to `scope` as long as using splat hash.
* add missing collection.reload documentation [ci skip]Julia López2017-08-081-4/+12
|
* add reload_association to documentation [ci skip]Julia López2017-08-071-0/+8
|
* Eager load the association classes on bootRafael Mendonça França2017-07-271-7/+7
| | | | | | | | | | | We were expecting those classes to be loaded when an association is defined but they are not. If you add a debugger on the first line of any of those classes and try to define the corresponding association you will see that the classes are not loaded. Fixes #26273
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* [Active Record] require => require_relativeAkira Matsuda2017-07-011-1/+1
|
* Remove deprecated option from docs [ci skip] (#29459)Vipul A M2017-06-151-6/+6
|
* Fix association documentationRafael Mendonça França2017-05-161-6/+5
| | | | | | | The object inside the scope is of the class that define the association not the associated class. [ci skip]
* :scissors:Ryuta Kamizono2017-04-131-1/+1
| | | | [ci skip]
* Add :default option to belongs_to (#28453)George Claghorn2017-03-171-0/+4
| | | | | | | | | | | 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 }
* Suppress deprecation message to `has_and_belongs_to_many` only onceRyuta Kamizono2017-01-101-2/+2
| | | | | Passing a class to `has_and_belongs_to_many` show deprecation message three times. It is enough only once.
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-051-1/+1
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* Raise error when has_many through is defined before through associationChris Holmes2017-01-041-0/+10
| | | | | | | https://github.com/rails/rails/issues/26834 This change raises an error if a has_many through association is defined before the through association.
* [ci skip] Retouch some association wording.Kasper Timm Hansen2016-12-311-3/+4
| | | | | Trim some needless words off the lines and format the code sample like we'd write in the Rails source.
* [ci skip] Remove mention of GeneratedAssociationMethodsKasper Timm Hansen2016-12-311-4/+3
| | | | | Marked as private in 2afe5a1 and doesn't seem worth it to mention the module name here.
* Raise when a through association has an ambiguous reflection nameRafael Mendonça França2016-12-291-0/+15
|
* No need to nodoc private methodsAkira Matsuda2016-12-241-2/+2
|
* `eager_autoload` needs to be triggered for nested constants.Yves Senn2016-11-211-0/+5
| | | | | | | | | | | | | | | When `ActiveRecord::Associations.eager_load!` is called, it eager loads the `Preloader` but does not trigger a `eager_load!` on the `Preloader` itself. A eager loaded component is responsible to forward the `eager_load!` call to nested constants that make use of `eager_autoload` as well. This will also resolve the occasional `NameError` that we've observed in production: ``` NameError: uninitialized constant ActiveRecord::Associations::Preloader::BelongsTo ```
* Add missing `+` around a some literals.bogdanvlviv2016-10-271-1/+1
| | | | | | Mainly around `nil` [ci skip]
* Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-141-876/+876
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* Fix broken heredoc indentation caused by rubocop auto-correctRyuta Kamizono2016-09-031-6/+6
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But heredocs was still kept absolute position. This commit aligns heredocs indentation for consistency.
* Use splat `options` hash for `has_and_belongs_to_many`Ryuta Kamizono2016-08-261-6/+1
| | | | For simplicity.
* Doc on scoped has_many, dependent: :destroyPhilip Nguyen2016-08-221-0/+6
| | | | | | | | | This is to close #26111 Developers need to be aware that `dependent: :destroy` on a scoped `has_many` association would only destroy the associated objects in that scope. Potentially leaving other associated objects outside that scope untouched.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-659/+659
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in activerecord/libXavier Noria2016-08-061-11/+11
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* [ci skip] Fix grammar in AR::AssociationsAlex Kitchens2016-07-181-13/+13
|
* Tiny document fixes [ci skip]Robin Dupret2016-05-301-1/+1
| | | | | | Add a missing capital letter and avoid using absolute links to the API because they may refer to out-dated documentation on the Edge site.
* Merge pull request #22240 from resource11/resource11-patch-1Arthur Nogueira Neves2016-05-291-4/+4
|\ | | | | Requesting documentation update
| * Issue 22240: adds link to list of instance methods [ci skip]Kathleen McMahon2016-03-181-4/+4
| | | | | | | | | | | | | | | | Update associations.rb Update associations.rb updates link to instance methods [ci skip]
* | Merge pull request #24672 from mrkjlchvz/mc-space-bumpRafael França2016-04-211-1/+1
|\ \ | | | | | | Minor space bump.
| * | Minor space bump.Mark2016-04-211-1/+1
| | |
* | | [ci skip] Update ActiveRecord associations documentation to avoid confusion ↵Tomasz Stachewicz2016-04-181-4/+8
|/ / | | | | | | with :validate option. Caused by #24532.
* | [ci skip] relations inside <tt> tagSourav Moitra2016-03-271-1/+1
| | | | | | | | | | | | s removed objects added