aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
Commit message (Collapse)AuthorAgeFilesLines
* [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
* | Merge pull request #23387 from mcfiredrill/clarify-touching-callbacksKasper Timm Hansen2016-01-311-0/+2
|\ \ | | | | | | clarify the touch true option does not trigger after_save/update [ci skip]
| * | clarify the touch true option does not trigger after_save/update [ci skip]Tony Miller2016-02-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | I've gotten tripped up more than a few times on this, thinking that using `belongs_to` with `touch: true` would trigger my after_save or after_update callbacks. The same text is in the documentation for the touch method itself, but I think its helpful to repeat it again here. It might save people some time.
* | | update doc for << method of has_many associationankit19102016-01-141-0/+1
| | |
* | | Expanding the documentation for collection=objects for has_many :through ↵Eric Krause2015-12-171-1/+2
| | | | | | | | | | | | [ci-skip]
* | | Use a real migration version number in docsMatthew Draper2015-12-151-1/+1
| | | | | | | | | | | | | | | Even though this means more things to change when we bump after a release, it's more important that our examples are directly copyable.
* | | Use a deliberately-invalid migration version in all doc examplesMatthew Draper2015-12-151-1/+1
| |/ |/| | | | | | | | | | | | | | | | | If we use a real version, at best that'll be an onerous update required for each release; at worst, it will encourage users to write new migrations against an older version than they're using. The other option would be to leave these bare, without any version specifier. But as that's just a variant spelling of "4.2", it would seem to raise the same concerns as above.
* | Fix Typo in EagerLoadPolymorphicError [ci skip]Alex Myers2015-10-271-1/+1
| |
* | Do not omit parentheses [ci skip]Ryuta Kamizono2015-10-251-11/+11
| |
* | [ci skip] readonly options has been removedIgnatius Reza2015-10-161-2/+0
|/