Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | fix HABTM w/out primary key errors on destruction | Kevin Casey | 2014-02-02 | 1 | -1/+1 |
| | |||||
* | Raise `RecordNotDestroyed` when children can't be replaced | Brian Thomas Storti | 2013-11-25 | 1 | -1/+1 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #12812 Raise `ActiveRecord::RecordNotDestroyed` when a child marked with `dependent: destroy` can't be destroyed. The following code: ```ruby class Post < ActiveRecord::Base has_many :comments, dependent: :destroy end class Comment < ActiveRecord::Base before_destroy do return false end end post = Post.create!(comments: [Comment.create!]) post.comments = [Comment.create!] ```` would result in a `post` with two `comments`. With this commit, the same code would raise a `RecordNotDestroyed` exception, keeping the `post` with the same `comment`. | ||||
* | Make sure inverse_of is visible on the has_many callbacks | Arthur Neves | 2013-09-25 | 1 | -0/+1 |
| | |||||
* | hm:t join tables may not have a primary key | Aaron Patterson | 2013-09-06 | 1 | -1/+5 |
| | |||||
* | Revert "Merge pull request #11416 from tigrish/master" | Yves Senn | 2013-07-22 | 1 | -1/+1 |
| | | | | | This reverts commit 9dc8aef084fc5ae7e3a396dd098d89da93d06fda, reversing changes made to 02e8dae6279ea25312293a3eca777faf35139c4c. | ||||
* | Remove ambiguity with pluralizations and I18n keys used for association ↵ | Christopher Dell | 2013-07-13 | 1 | -1/+1 |
| | | | | restrict_dependent_destroy errors | ||||
* | Dropped deprecated option `:restrict` for `:dependent` in associations | Neeraj Singh | 2013-07-03 | 1 | -1/+1 |
| | |||||
* | Removed support for deprecated `finder_sql` in associations. | Neeraj Singh | 2013-07-02 | 1 | -2/+0 |
| | |||||
* | Removed support for deprecated `counter_sql` | Neeraj Singh | 2013-07-02 | 1 | -1/+1 |
| | |||||
* | Fix the `:primary_key` option for `has_many` associations. | Yves Senn | 2013-05-23 | 1 | -2/+1 |
| | | | | | | | | | | | | | | | | | When removing records from a `has_many` association it used the `primary_key` defined on the association. Our test suite didn't fail because on all occurences of `:primary_key`, the specified column was available in both tables. This prevented the code from raising an exception but it still behaved badly. I added a test-case to prevent regressions that failed with: ``` 1) Error: HasManyAssociationsTest#test_has_many_assignment_with_custom_primary_key: ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: essays.first_name: UPDATE "essays" SET "writer_id" = NULL WHERE "essays"."writer_id" = ? AND "essays"."first_name" IS NULL ``` | ||||
* | Update other counter caches on destroy | Ian Young | 2013-03-20 | 1 | -1/+1 |
| | |||||
* | dependent: :destroy should call destroy_all | Neeraj Singh | 2013-03-11 | 1 | -2/+3 |
| | | | | | | | | | | | | | | Commit https://github.com/rails/rails/pull/9668 shows warning when `delete_all` is invoked with `:dependent` option `:destroy`. Unfortunately invoking `Post.destroy_all` invokes `post.comments.delete_all` as part of `has_many` callbacks. This commit ensures that instead `post.comments.destroy_all` is invoked and in the process no warning is generated. See issue #9567 for details . | ||||
* | :counter_cache option for to support custom named counter caches. Closes #7993 | Yves Senn | 2012-11-04 | 1 | -1/+1 |
| | |||||
* | move dependency logic out of generated methods | Jon Leighton | 2012-08-10 | 1 | -0/+22 |
| | |||||
* | s/scoped/scope/ | Jon Leighton | 2012-08-01 | 1 | -3/+3 |
| | |||||
* | Revert "Remove :finder_sql, :counter_sql, :insert_sql, :delete_sql." | Jon Leighton | 2012-08-01 | 1 | -1/+7 |
| | | | | | | | | | This reverts commit 3803fcce26b837c0117f7d278b83c366dc4ed370. Conflicts: activerecord/CHANGELOG.md It will be deprecated only in 4.0, and removed properly in 4.1. | ||||
* | Remove :finder_sql, :counter_sql, :insert_sql, :delete_sql. | Jon Leighton | 2012-07-20 | 1 | -7/+1 |
| | |||||
* | Represent association scope options as AR::Relations insternally. | Jon Leighton | 2012-07-13 | 1 | -1/+1 |
| | |||||
* | Perf: Don't load the association for #delete_all. | Jon Leighton | 2012-05-18 | 1 | -2/+6 |
| | | | | Bug #6289 | ||||
* | Fix #3672 again (dependent: delete_all perf) | Jon Leighton | 2011-12-14 | 1 | -7/+3 |
| | |||||
* | load has_many associations keyed off a custom primary key if that key is ↵ | Brian Samson | 2011-11-25 | 1 | -0/+4 |
| | | | | present but the record is unsaved | ||||
* | Perf fix | Jon Leighton | 2011-11-19 | 1 | -2/+6 |
| | | | | | | | If we're deleting all records in an association, don't add a IN(..) clause to the query. Fixes #3672. | ||||
* | Only save the record once when calling create! on a collection association. ↵ | Jon Leighton | 2011-05-31 | 1 | -2/+7 |
| | | | | Fixes #1360. | ||||
* | Remove extra white spaces on ActiveRecord docs. | Sebastian Martinez | 2011-05-23 | 1 | -1/+1 |
| | |||||
* | Move the code which builds a scope for through associations into a generic ↵ | Jon Leighton | 2011-03-10 | 1 | -2/+0 |
| | | | | AssociationScope class which is capable of building a scope for any association. | ||||
* | Use proper objects to do the work to build the associations (adding methods, ↵ | Jon Leighton | 2011-02-21 | 1 | -0/+1 |
| | | | | callbacks etc) rather than calling a whole bunch of methods with rather long names. | ||||
* | Delegate Association#options to the reflection, and replace ↵ | Jon Leighton | 2011-02-21 | 1 | -2/+2 |
| | | | | 'reflection.options' with 'options'. Also add through_options and source_options methods for through associations. | ||||
* | Associations - where possible, call attributes methods rather than directly ↵ | Jon Leighton | 2011-02-21 | 1 | -16/+16 |
| | | | | accessing the instance variables | ||||
* | Split AssociationProxy into an Association class (and subclasses) which ↵ | Jon Leighton | 2011-02-18 | 1 | -7/+5 |
| | | | | manages the association, and a CollectionProxy class which is *only* a proxy. Singular associations no longer have a proxy. See CHANGELOG for more. | ||||
* | Get rid of AssociationCollection#save_record | Jon Leighton | 2011-02-14 | 1 | -2/+2 |
| | |||||
* | Refactor the implementations of AssociatioCollection#delete and #destroy to ↵ | Jon Leighton | 2011-02-07 | 1 | -1/+1 |
| | | | | be more consistent with each other, and to stop passing blocks around, thus making the execution easier to follow. | ||||
* | Correctly update counter caches on deletion for has_many :through [#2824 ↵ | Jon Leighton | 2011-02-07 | 1 | -15/+39 |
| | | | | state:resolved]. Also fixed a bunch of other counter cache bugs in the process, as once I fixed this one others started appearing like nobody's business. | ||||
* | Make record.association.destroy(*records) on habtm and hm:t only delete ↵ | Jon Leighton | 2011-02-07 | 1 | -11/+11 |
| | | | | records in the join table. This is to make the destroy method more consistent across the different types of associations. For more details see the CHANGELOG entry. | ||||
* | Rename AssociationProxy#loaded to loaded! as it mutates the association | Jon Leighton | 2011-01-30 | 1 | -1/+1 |
| | |||||
* | Let's be less blasé about method visibility on association proxies | Jon Leighton | 2011-01-30 | 1 | -5/+8 |
| | |||||
* | Construct an actual ActiveRecord::Relation object for the association scope, ↵ | Jon Leighton | 2011-01-07 | 1 | -3/+1 |
| | | | | rather than a hash which is passed to apply_finder_options. This allows more flexibility in how the scope is created, for example because scope.where(a, b) and scope.where(a).where(b) mean different things. | ||||
* | Create the association scope directly rather than going through with_scope | Jon Leighton | 2011-01-03 | 1 | -1/+1 |
| | |||||
* | Use the association directly in other places too | Jon Leighton | 2011-01-03 | 1 | -4/+2 |
| | |||||
* | Let AssociationCollection#find use #scoped to do its finding. Note that I am ↵ | Jon Leighton | 2011-01-03 | 1 | -10/+0 |
| | | | | removing test_polymorphic_has_many_going_through_join_model_with_disabled_include, since this specifies different behaviour for an association than for a regular scope. It seems reasonable to expect scopes and association proxies to behave in roughly the same way rather than having subtle differences. | ||||
* | Rename AssociationReflection#primary_key_name to foreign_key, since the ↵ | Jon Leighton | 2010-12-31 | 1 | -1/+1 |
| | | | | options key which it relates to is :foreign_key | ||||
* | And owner_quoted_id can go too | Jon Leighton | 2010-12-31 | 1 | -8/+0 |
| | |||||
* | Refactor we_can_set_the_inverse_on_this? to use a less bizarre name amongst ↵ | Jon Leighton | 2010-12-26 | 1 | -4/+0 |
| | | | | other things | ||||
* | Associations: DRY up the code which is generating conditions, and make it ↵ | Jon Leighton | 2010-12-26 | 1 | -16/+2 |
| | | | | all use arel rather than SQL strings | ||||
* | Remove target_obsolete? which is not called from anywhere | Jon Leighton | 2010-12-26 | 1 | -4/+0 |
| | |||||
* | Avoid Symbol#to_proc for performance reasons in Ruby 1.8 | Jon Leighton | 2010-12-20 | 1 | -3/+3 |
| | |||||
* | has_many associations with :dependent => :delete_all should update the ↵ | Jon Leighton | 2010-12-20 | 1 | -1/+3 |
| | | | | counter cache when deleting records | ||||
* | Refactor delete_records in HasManyAssociation | Jon Leighton | 2010-12-20 | 1 | -7/+8 |
| | |||||
* | Specify insert_record with NotImplementedError in AssociationCollection, to ↵ | Jon Leighton | 2010-12-20 | 1 | -1/+1 |
| | | | | indicate that subclasses should implement it. Also add save_record to reduce duplication. | ||||
* | removing more calls to deprecated methods | Aaron Patterson | 2010-12-02 | 1 | -2/+3 |
| | |||||
* | reduce method calls | Aaron Patterson | 2010-11-24 | 1 | -1/+1 |
| |