Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Merge pull request #12450 from iantropov/master | Rafael Mendonça França | 2014-06-27 | 1 | -0/+5 |
|\ | | | | | | | | | | | | | | | | | Fix bug, when ':dependent => :destroy' violates foreign key constraints Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/associations/builder/association.rb activerecord/lib/active_record/associations/builder/has_one.rb | ||||
| * | Fix bug, when ':dependent => :destroy' option violates foreign key ↵ | Ivan Antropov | 2013-10-26 | 1 | -0/+4 |
| | | | | | | | | constraints, issue #12380 | ||||
* | | Prevented belongs_to: touch propagating up if there are no changes being saved | Brock Trappitt | 2014-05-21 | 1 | -1/+1 |
| | | |||||
* | | Hide BelongsToAssociation#increment_counters and #decrement_counters | Jean Boussier | 2014-04-15 | 1 | -1/+0 |
| | | |||||
* | | Use inheritance chain instead of callbacks to increment counter caches after ↵ | Jean Boussier | 2014-04-14 | 1 | -16/+0 |
| | | | | | | | | destroy | ||||
* | | Use inheritance chain instead of callbacks to increment counter caches after ↵ | Jean Boussier | 2014-04-14 | 1 | -12/+1 |
| | | | | | | | | create | ||||
* | | Make counter cache decrementation on destroy idempotent | Jean Boussier | 2014-04-13 | 1 | -4/+5 |
| | | |||||
* | | On destroying do not touch destroyed belongs to association. | Paul Nikitochkin | 2013-12-23 | 1 | -1/+1 |
| | | | | | | | | Fixes: #13445 | ||||
* | | Revert the whole refactoring in the association builder classes. | Rafael Mendonça França | 2013-12-11 | 1 | -2/+4 |
| | | | | | | | | This is to get activerecord-deprecated_finders work again | ||||
* | | Bring back the valid_options class accessor | Rafael Mendonça França | 2013-12-11 | 1 | -1/+1 |
| | | | | | | | | It is need in activerecord-deprecated_finders | ||||
* | | polymorphic belongs_to association with touch: true updates old record correctly | Severin Schoepke | 2013-12-05 | 1 | -1/+7 |
| | | | | | | | | | | | | | | | | | | Example: Given you have a comments model with a polymorphic commentable association (e.g. books and songs) with the touch option set. Every time you update a comment its commentable should be touched. This was working when you changed attributes on the comment or when you moved the comment from one book to another. However, it was not working when moving a comment from a book to a song. This is now fixed. | ||||
* | | Raise `ArgumentError` when `has_one` is used with `counter_cache` | Godfrey Chan | 2013-11-29 | 1 | -1/+1 |
| | | | | | | | | | | | | | | | | | | Previously, the `has_one` macro incorrectly accepts the `counter_cache` option due to a bug, although that options was never supported nor functional on `has_one` and `has_one ... through` relationships. It now correctly raises an `ArgumentError` when passed that option. For reference, this bug was introduced in 52f8e4b9. | ||||
* | | Method visibility will not make difference here | Rafael Mendonça França | 2013-10-09 | 1 | -2/+0 |
| | | |||||
* | | Move macro to class level | Rafael Mendonça França | 2013-10-09 | 1 | -1/+1 |
| | | |||||
* | | Make valid_options a class method | Rafael Mendonça França | 2013-10-09 | 1 | -1/+1 |
| | | |||||
* | | Push define_accessors to class level since we don't need anythig from | Rafael Mendonça França | 2013-10-08 | 1 | -2/+2 |
| | | | | | | | | the instance | ||||
* | | Move add_counter_cache_methods to class level | Rafael Mendonça França | 2013-10-08 | 1 | -2/+2 |
| | | |||||
* | | we can define callbacks without a builder instance | Aaron Patterson | 2013-10-02 | 1 | -3/+3 |
| | | |||||
* | | push methods that don't depend on the instance to the class | Aaron Patterson | 2013-10-02 | 1 | -4/+4 |
| | | |||||
* | | decouple belongs_to callback definition from the builder instance. | Aaron Patterson | 2013-10-02 | 1 | -4/+4 |
| | | | | | | | | All the information is on the reflection, so just get it there. | ||||
* | | valid_options doesn't depend on the instance, so push it to the class | Aaron Patterson | 2013-10-02 | 1 | -1/+1 |
| | | |||||
* | | association builder is no longer needed for counter cache, so remove it | Aaron Patterson | 2013-10-02 | 1 | -7/+6 |
| | | |||||
* | | push constructable? on to the reflection | Aaron Patterson | 2013-10-02 | 1 | -6/+2 |
| | | |||||
* | | name is on the reflection, so just use the reflection | Aaron Patterson | 2013-10-02 | 1 | -2/+2 |
|/ | |||||
* | remove dependency on @model when defining callbacks | Aaron Patterson | 2013-08-01 | 1 | -5/+5 |
| | |||||
* | extract more mutations to the caller | Aaron Patterson | 2013-08-01 | 1 | -7/+6 |
| | |||||
* | separate some mutations from reflection construction | Aaron Patterson | 2013-08-01 | 1 | -1/+5 |
| | |||||
* | #11288: Removed duplicated touching | Paul Nikitochkin | 2013-07-05 | 1 | -1/+1 |
| | | | | | | if belongs to model with touch option on touch Closes #11288 | ||||
* | stop adding a new method for touch callbacks | Aaron Patterson | 2013-06-11 | 1 | -29/+21 |
| | |||||
* | push the touch method outside the eval | Aaron Patterson | 2013-06-11 | 1 | -13/+34 |
| | |||||
* | remove unused variable | Aaron Patterson | 2013-06-11 | 1 | -1/+0 |
| | |||||
* | check whether the association is constructible rather than checking constants | Aaron Patterson | 2013-06-11 | 1 | -3/+3 |
| | |||||
* | use attribute methods for finding key values rather than generating method names | Aaron Patterson | 2013-06-11 | 1 | -3/+3 |
| | |||||
* | push belongs_to counter cache method to a single method | Aaron Patterson | 2013-06-11 | 1 | -17/+18 |
| | |||||
* | push before_destroy counter cache method to a single method | Aaron Patterson | 2013-06-11 | 1 | -12/+17 |
| | |||||
* | remove evaled belongs_to counter cache method | Aaron Patterson | 2013-06-11 | 1 | -8/+22 |
| | |||||
* | adding callbacks should be private | Aaron Patterson | 2013-06-11 | 1 | -4/+6 |
| | |||||
* | Confirm a record has not already been destroyed before decrementing | Ben Tucker | 2013-05-06 | 1 | -1/+3 |
| | | | | | | | | | counter cache At present, calling destroy multiple times on the same record results in the belongs_to counter cache being decremented multiple times. With this change the record is checked for whether it is already destroyed prior to decrementing the counter cache. | ||||
* | Lookup the class at runtime, not when the association is built | Andrew White | 2013-04-24 | 1 | -2/+2 |
| | | | | | | | | | Trying to lookup the parent class when the association is being built runs the risk of generating uninitialized constant errors because classes haven't been fully defined yet. To work around this we look up the class at runtime through the `association` method. Fixes #10197. | ||||
* | Revert "Revert "`belongs_to :touch` behavior now touches old association ↵ | Andrew White | 2013-04-24 | 1 | -1/+12 |
| | | | | | | | | | when transitioning to new association" until a proper fix is found for #10197" This reverts commit 7389df139a35436f00876c96d20e81ba23c93f0a. Conflicts: activerecord/test/cases/timestamp_test.rb | ||||
* | Revert "`belongs_to :touch` behavior now touches old association when ↵ | David Heinemeier Hansson | 2013-04-23 | 1 | -12/+1 |
| | | | | transitioning to new association" until a proper fix is found for #10197 | ||||
* | Update counter cache when pushing into association | Matthew Robertson | 2013-04-21 | 1 | -3/+4 |
| | | | | | | | | | | | | | | | | This commit fixes a regression bug in which counter_cache columns were not being updated correctly when newly created records were being pushed into an assocation. EG: # this was fine @post.comment.create! # this was fine @comment = Comment.first @post.comments << @comment # this would not update counters @post.comments << Comment.create! | ||||
* | Avoid an attempt to fetch old record when id was not present in touch callback | Carlos Antonio da Silva | 2013-04-04 | 1 | -7/+7 |
| | |||||
* | Use the correct pk field from the reflected class to find the old record | Carlos Antonio da Silva | 2013-04-04 | 1 | -1/+2 |
| | | | | | | | | | | | | | | | | | | | | | | | | | The implementation was using the source class foreign key field instead of the reflected primary key one to find the old record. For instance, for this scenario class Bulb < ActiveRecord::Base belongs_to :car, :touch => true end class Car < ActiveRecord::Base has_many :bulbs end the current implementation was trying to do this query: Car.where(car_id: X).first where we should be doing this query: Car.where(id: X).first This should hopefully fix the build. | ||||
* | Use inspect when writing the foreign key from the reflection | Andrew White | 2013-04-05 | 1 | -2/+2 |
| | | | | | | If we don't use inspect inside the class_eval block then the foreign key is written without quotes causing us to fetch the foreign key value and not the column name. | ||||
* | Merge pull request #9141 from adamgamble/issue-9091 | David Heinemeier Hansson | 2013-04-03 | 1 | -0/+10 |
|\ | | | | | belongs_to :touch should touch old record when transitioning. | ||||
| * | Modifies belong_to touch callback to touch old associations also #9091 | Adam Gamble | 2013-03-14 | 1 | -0/+10 |
| | | |||||
* | | Update other counter caches on destroy | Ian Young | 2013-03-20 | 1 | -1/+1 |
| | | |||||
* | | If a counter_cache is defined, then using update_attributes and changing | John Wang | 2013-03-15 | 1 | -0/+20 |
|/ | | | | | the primary key on an association will make sure that the corresponding counter on the association is changed properly. Fixes #9722. | ||||
* | Fix touching an invalid parent record for belongs_to | Olek Janiszewski | 2013-02-26 | 1 | -1/+1 |
| | | | | | | | | | | | | | | | | | | | | | | If the parent of a `belongs_to` record fails to be saved due to validation errors, `touch` will be called on a new record, which causes an exception (see https://github.com/rails/rails/pull/9320). Example: class Owner < ActiveRecord::Base validates_presence_of :name end class Pet < ActiveRecord::Base belongs_to :owner, touch: true end pet = Pet.new(owner: Owner.new) # Before, this line would raise ActiveRecord::ActiveRecordError # "can not touch on a new record object" pet.save |