aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/reply.rb
Commit message (Collapse)AuthorAgeFilesLines
* Avoid the same `foreign_key` and `counter_cache` associations on `SillyReply`Ryuta Kamizono2018-09-191-4/+4
| | | | | | | | | `topic` and `reply` belongs_to associations on `SillyReply` are defined with the same `foreign_key` (`parent_id`) and `counter_cache` (`replies_count`) columns. This would cause unintentional side-effect (e.g. saving `SillyReply` object would cause double increment `replies_count`), so it is better to avoid that side-effect.
* Reuse existing model for testing duplicated children recordsRyuta Kamizono2018-06-071-4/+1
| | | | Follow up of #32952.
* Merge pull request #32952 from mechanicles/32940-fixRyuta Kamizono2018-05-291-0/+5
|\ | | | | | | Fix parent record should not get saved with duplicate children records
| * Fix parent record should not get saved with duplicate children recordsSantosh Wadghule2018-05-281-0/+5
| | | | | | | | - Fixes #32940
* | Fix inconsistent touching behavior between assigning and unassigningRyuta Kamizono2018-05-271-1/+1
|/ | | | | | | | | | | On belongs_to with `touch: true` association, unassigned object is caused touching, but assigned object is not touched. And also, if primary key is customized, it will touch against the wrong target looked up by the customized key as primary key. This change ensures correctly touching consistently between assigning and unassigning.
* 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-11/+11
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-4/+4
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Add test to AR's counter_cache_test.rbTakehiro Adachi2013-05-181-0/+1
| | | | | | | According to https://github.com/rails/rails/blob/b601399b72ab56cc01368f02615af99f45d1 4f02/activerecord/lib/active_record/counter_cache.rb#L14, u can pass more then one association to the `reset_counters` method.
* unused scopeAkira Matsuda2013-01-021-2/+0
|
* Remove mass assignment security from ActiveRecordGuillermo Iguaran2012-09-161-2/+0
|
* Deprecate eager-evaluated scopes.Jon Leighton2012-03-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use this: scope :red, where(color: 'red') default_scope where(color: 'red') Use this: scope :red, -> { where(color: 'red') } default_scope { where(color: 'red') } The former has numerous issues. It is a common newbie gotcha to do the following: scope :recent, where(published_at: Time.now - 2.weeks) Or a more subtle variant: scope :recent, -> { where(published_at: Time.now - 2.weeks) } scope :recent_red, recent.where(color: 'red') Eager scopes are also very complex to implement within Active Record, and there are still bugs. For example, the following does not do what you expect: scope :remove_conditions, except(:where) where(...).remove_conditions # => still has conditions
* DRY up the code which instantiates the association proxyJon Leighton2011-01-111-0/+7
|
* Fix failing test.José Valim2010-05-211-3/+3
|
* Make sure valid? preceives the context as in ActiveModel API (ht: Carlos ↵José Valim2010-05-101-0/+5
| | | | Antonio)
* Rename named_scope to scopePratik Naik2010-01-181-1/+1
|
* Simplify repair_validations on AR and make it work with new callbacks.José Valim2010-01-011-2/+4
|
* Changed ActiveRecord to use new callbacks and speed up observers by only ↵José Valim2009-09-081-4/+4
| | | | | | notifying events that are actually being consumed. Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Add primary_key option to belongs_to associationSzymon Nowak2009-07-151-1/+2
| | | | | | [#765 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Deprecate Model#validate/validate_on_create/validate_on_update. Use ↵Pratik Naik2009-03-211-3/+7
| | | | Model.validate :method and likewise
* Move all the Active Record validations to Active ModelPratik Naik2009-03-191-5/+5
|
* Ensure belongs_to association with a counter cache in name spaced model ↵Adam Cooper2009-03-061-0/+6
| | | | | | works [#1678 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fix file permissionsTarmo Tänav2008-07-311-0/+0
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Change tests against all scope to base scope as all is now used as a finder ↵David Heinemeier Hansson2008-04-301-0/+2
| | | | alias
* Fix pathsJeremy Kemper2008-01-181-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8661 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* move assets and modelsJeremy Kemper2008-01-181-0/+37
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8657 5ecf4fe2-1ee6-0310-87b1-e25e094e27de