aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/face.rb
Commit message (Collapse)AuthorAgeFilesLines
* Make `reflection.klass` raise if `polymorphic?` not to be misusedRyuta Kamizono2018-02-191-0/+1
| | | | | | | | | | | | | | | | This is an alternative of #31877 to fix #31876 caused by #28808. This issue was caused by a combination of several loose implementation. * finding automatic inverse association of polymorphic without context (caused by #28808) * returning `klass` even if `polymorphic?` (exists before #28808) * loose verification by `valid_inverse_reflection?` (exists before #28808) This makes `klass` raise if `polymorphic?` not to be misused. This issue will not happen unless polymorphic `klass` is misused. Fixes #31876. Closes #31877.
* Inverse instance should not be reloaded during autosave if called in validationAnmol Chopra2017-11-271-0/+4
| | | | | Record saved in save_has_one_association already make call to association.loaded! via record's before_save callback of save_belongs_to_association, but this will reload object if accessed in record's validation.
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-5/+5
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Typo fix [ci skip]amitkumarsuroliya2015-09-071-1/+1
| | | `lengh` should be `length`
* Address ORA-00972: identifier is too long when tested with OracleYasuo Honda2014-07-141-1/+2
| | | | by using shorter attribute names.
* use name specified by 'as' for automatic inverse association to avoid ↵Andrew S. Brown2014-06-101-0/+1
| | | | reflecting on wrong association
* Make polymorphic_inverse_of in Reflection throw an ↵Murray Steele2009-12-281-1/+2
| | | | | | InverseOfAssociationNotFoundError if the supplied class doesn't have the appropriate association. [#3520 state:resolved] Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
* Add inverse polymorphic association support. [#3520 state:resolved]George Ogata2009-12-281-0/+1
| | | | Signed-off-by: Eloy Duran <eloy.de.enige@gmail.com>
* Providing support for :inverse_of as an option to associations.Murray Steele2009-05-041-0/+5
You can now add an :inverse_of option to has_one, has_many and belongs_to associations. This is best described with an example: class Man < ActiveRecord::Base has_one :face, :inverse_of => :man end class Face < ActiveRecord::Base belongs_to :man, :inverse_of => :face end m = Man.first f = m.face Without :inverse_of m and f.man would be different instances of the same object (f.man being pulled from the database again). With these new :inverse_of options m and f.man are the same in memory instance. Currently :inverse_of supports has_one and has_many (but not the :through variants) associations. It also supplies inverse support for belongs_to associations where the inverse is a has_one and it's not a polymorphic. Signed-off-by: Murray Steele <muz@h-lame.com> Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>