aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* | 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
|/
* applies new doc guidelines to Active Record.Yves Senn2015-10-141-95/+100
| | | | | | | | | | | | | | | | | | | The focus of this change is to make the API more accessible. References to method and classes should be linked to make it easy to navigate around. This patch makes exzessiv use of `rdoc-ref:` to provide more readable docs. This makes it possible to document `ActiveRecord::Base#save` even though the method is within a separate module `ActiveRecord::Persistence`. The goal here is to bring the API closer to the actual code that you would write. This commit only deals with Active Record. The other gems will be updated accordingly but in different commits. The pass through Active Record is not completely finished yet. A follow up commit will change the spots I haven't yet had the time to update. /cc @fxn
* document `EagerLoadPolymorphicError`. [ci skip]Yves Senn2015-10-131-2/+4
| | | | | | | | | This error is raised in certain situations when eager loading polymorphic associations. We even mention it in our docs. It should be included in our API. Conflicts: activerecord/lib/active_record/associations.rb
* Remove unnecessary display widthRyuta Kamizono2015-09-161-3/+3
| | | | | | | The **(11)** does not affect the storage size of the data type, which for an INT will always be 4 bytes. It affects the **display width**. http://www.tocker.ca/2015/07/02/proposal-to-deprecate-mysql-integer-display-width-and-zerofill.html
* Make ActiveRecordException descendants args optionalPavel Pravosud2015-09-071-35/+99
| | | | | | This change allows to instantiate all ActiveRecordError descendant execption classes without arguments, which might be useful in testing and is far less surprising than mandatory arguments.
* RDoc: fix wrong model name `:inverse_of` with `:belongs_to` [ci skip]Vladimir Rybas2015-07-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a typo in ActiveRecord associations RDocs. Wrong `Taggable` model name, instead of `Tagging` in example of using option `:inverse_of` with `:belongs_to` association. Commit where typo was introduced: https://github.com/rails/rails/commit/91fd6510563f84ee473bb217bc63ed598abe3f24#diff-39001423802a8470dba9c931e66e101eR11 First it appears in `activerecord/CHANGELOG` in example of `:inverse_of` usage: ```ruby class Post < ActiveRecord::Base has_many :taggings has_many :tags, :through => :taggings end class Tagging < ActiveRecord::Base belongs_to :post belongs_to :tag, :inverse_of => :tagging # :inverse_of must be set! end class Tag < ActiveRecord::Base has_many :taggings has_many :posts, :through => :taggings end post = Post.first tag = post.tags.build :name => "ruby" !> tag.save # will save a Taggable linking to the post ``` The last line should be ```ruby tag.save # will save a Tagging linking to the post ``` The same typo appears in `activerecord/lib/active_record/associations.rb`. The association name is given as `:inverse_of => :taggings`, but class name is `Taggable`. ```ruby # @post = Post.first # @tag = @post.tags.build :name => "ruby" # @tag.save # !> # The last line ought to save the through record (a <tt>Taggable</tt>). This will only work if the # <tt>:inverse_of</tt> is set: # !> # class Taggable < ActiveRecord::Base # belongs_to :post !> # belongs_to :tag, :inverse_of => :taggings # end ``` This PR fixes model name.
* Fix misleading errors for has_one through relationsMehmet Emin İNAÇ2015-07-221-2/+14
|
* [ci skip] Fix the API docs for Bi-directional associationsRoque Pinel2015-06-131-12/+7
| | | | | The examples now take in consideration when Active Record finds inverse associations automatically.
* add `extend` option on `has_and_belongs_to_many`.keepcosmos2015-05-261-1/+1
|
* deprecate `Relation#uniq` use `Relation#distinct` instead.Yves Senn2015-05-261-1/+0
| | | | | | | | | See #9683 for the reasons we switched to `distinct`. Here is the discussion that triggered the actual deprecation #20198. `uniq`, `uniq!` and `uniq_value` are still around. They will be removed in the next minor release after Rails 5.
* parent_reflection should store only a reflection objectAaron Patterson2015-05-191-2/+2
| | | | | we should ask the reflection for its name rather than storing the reflection name in two places (an array and a reflection object)
* [ci skip] Fix comment of `ActiveRecord::Associations#association_instance_get`yui-knk2015-05-111-1/+1
|
* change GeneratedFeatureMethods to GeneratedAssociationMethods in docsRob Looby2015-05-081-1/+1
| | | | the module name was changed in 8e814a0ac0768816974d2bfd68d33d931592751e
* Apply edits from @senny to close #19397 [ci skip]Zachary Scott2015-04-121-4/+1
|
* Change join model name constant to private constantMehmet Emin İNAÇ2015-04-071-3/+1
| | | | This will resolve the fixme message which is about making constant invisible.
* remove unnecessary path parameterskeepcosmos2015-03-101-16/+16
|
* Tiny documentation edits [ci skip]Robin Dupret2015-02-241-3/+1
|
* Require `belongs_to` by default.Josef Šimánek2015-02-211-1/+7
| | | | Deprecate `required` option in favor of `optional` for belongs_to.
* Merge pull request #16989 from Empact/reload-cache-clearRafael Mendonça França2015-02-201-9/+27
|\ | | | | | | Isolate access to @associations_cache and @aggregations_cache to the Associations and Aggregations modules, respectively.
| * Isolate access to @associations_cache and @aggregations cache to the ↵Ben Woosley2014-09-281-9/+27
| | | | | | | | | | | | | | | | Associations and Aggregations modules, respectively. This includes replacing the `association_cache` accessor with a more limited `association_cached?` accessor and making `clear_association_cache` and `clear_aggregation_cache` private.
* | Replace deprecated readonly option with scope blocks in docs and guideKonstantinos Rousis2015-02-181-2/+2
| |
* | Merge branch 'master' of github.com:rails/docrailsVijay Dev2015-02-141-3/+3
|\ \
| * | Do not use the same name for two `:belongs_to`claudiob2015-02-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | A model cannot have two `:belongs_to` with the same exact name, so we are better off avoiding this code in our examples, which might mislead users in thinking it's admissible. [ci skip]
* | | [ci skip] corrects documentation for the default dependent behaviourAlex Handley2015-02-091-1/+1
| | | | | | | | | | | | | | | By default the foreign key will remain set with the parent id after destroy is fired.
* | | [ci skip] add note about has_one :through and :dependentpalkan2015-02-011-0/+4
|/ /
* | Document has_many :extend optionCaleb Thompson2015-01-081-0/+4
| | | | | | | | https://github.com/rails/rails/commit/5937bd02dee112646469848d7fe8a8bfcef5b4c1#commitcomment-9205786
* | Share foreign_key_present? implementation in _has_ associationsbrainopia2014-12-311-0/+1
| |
* | Add foreign_type option for polymorphic has_one and has_many.Ulisses Almeida + Kassio Borges2014-12-081-0/+12
| | | | | | | | | | | | | | To be possible to use a custom column name to save/read the polymorphic associated type in a has_many or has_one polymorphic association, now users can use the option :foreign_type to inform in what column the associated object type will be saved.
* | Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-1/+1
| |
* | Ensure HABTM relationships produce valid class names (Fixes #17119)Sammy Larbi2014-11-091-1/+1
| |
* | Raise an error for has_one associations which try to go :through a ↵Tu Hoang2014-10-151-0/+6
|/ | | | polymorphic association [#17263]
* Clarify the documentation of the primary_key option for associationsPeter Marsh2014-09-221-1/+1
| | | | | | | Previously the documentation stated that `primary_key` should be the name of a *method* that returns the primary key used for the association. This is incorrect. This changes the documentation to say that the value must be the name of a column.
* [ci skip] Added documentation for has_and_belongs_to_many extension parameterTom Kadwill2014-08-261-0/+15
|
* Fix a few typos [ci skip]Robin Dupret2014-08-241-1/+1
|
* [ci skip] Added documentation for has_many extension parameterTom Kadwill2014-08-241-0/+14
|
* [ci skip] Added documentation for has_and_belongs_to_many scope parameterTom Kadwill2014-08-221-0/+12
|
* Merge pull request #16204 from jonatack/patch-7Vijay Dev2014-08-211-12/+14
|\ | | | | Fix minor typos and improve grammar and code formatting
| * Grammar passJon Atack2014-08-191-12/+14
| | | | | | | | | | | | [ci skip] Add improvements from @eileencodes [skip ci]
* | [ci skip] Added documentation for has_one scope parameterTom Kadwill2014-08-211-0/+11
| |
* | [ci skip] Added documentation for has_many scope parameterTom Kadwill2014-08-201-0/+11
| |
* | Merge pull request #16475 from tomkadwill/has_many_scope_documentationZachary Scott2014-08-191-0/+11
|\ \ | | | | | | [ci skip] Added documentation for belongs_to scope parameter
| * | [ci skip] Added documentation for belongs_to scope parameterTom Kadwill2014-08-191-0/+11
| | |