aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove support to activerecord-deprecated_findersRafael Mendonça França2015-01-021-5/+5
|
* Allow habtm class_name option to be consistent with other associationsshiksha2014-11-131-1/+1
|
* Ensure HABTM relationships produce valid class names (Fixes #17119)Sammy Larbi2014-11-091-1/+1
|
* Change `gsub` to `tr` where possibleAlexander Balashov2014-10-061-1/+1
|
* Fix has_and_belongs_to_many in a namespaced model pointing to a non ↵Rafael Mendonça França2014-06-191-8/+5
| | | | | | | | | | | | | | | namespaced model Now the following case will work fine class Tag < ActiveRecord::Base end class Publisher::Article < ActiveRecord::Base has_and_belongs_to_many :tags end Fixes #15761
* Merge pull request #15210 from arthurnn/fix_hbtm_reflectionArthur Neves2014-05-241-2/+2
| | | | | | | | | Fix habtm reflection Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/counter_cache.rb activerecord/lib/active_record/reflection.rb activerecord/test/cases/reflection_test.rb
* Fixed the inferred table name for HABTM within a schemaEric Chahin2014-05-201-1/+1
| | | | Fixes #14824.
* Remove the assignment for real this time.Zachary Scott2014-05-161-2/+2
| | | | | | cc: https://github.com/rails/rails/commit/a11e2fcff8cdc9691b977d8330abe63024f8c732#commitcomment-6353614 and 0369dbf
* prepend mutates the string so we can remove the assignmentRafael Mendonça França2014-05-161-1/+1
|
* Don't use Active Support where it is not needed.Rafael Mendonça França2014-05-141-1/+3
| | | | | parent_name is a string of nil, never a blank string so we don't need to use presence.
* Fix how to compute class name on habtm namespaced.Kassio Borges2014-05-131-1/+5
| | | | | | Thank's for @laurocaetano for the help with tests. :smiley: Fixes #14709
* make sure cached table name is a string. fixes #12582Aaron Patterson2013-12-121-1/+1
|
* Revert the whole refactoring in the association builder classes.Rafael Mendonça França2013-12-111-5/+5
| | | | This is to get activerecord-deprecated_finders work again
* Remove builder instancesRafael Mendonça França2013-10-091-5/+5
| | | | | All the job can be done at class level so we can avoid some object allocation
* fix the variable nameAaron Patterson2013-10-021-7/+7
|
* repurpose the HABTM builder classAaron Patterson2013-10-021-24/+1
|
* keep track of the left and right reflections and expose thoseAaron Patterson2013-10-021-5/+5
|
* have the builder create the middle reflectionAaron Patterson2013-10-021-2/+13
|
* Merge branch 'master' into habtmAaron Patterson2013-10-021-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: we can define callbacks without a builder instance push methods that don't depend on the instance to the class get the name from the reflection cache the name and options on the stack decouple belongs_to callback definition from the builder instance. add_before_destroy_callbacks doesn't depend on the instance, so push it to the class. valid_options doesn't depend on the instance, so push it to the class use the information on the reflection to determine whether callbacks should be added Running all isolated test for actionview association builder is no longer needed for counter cache, so remove it push constructable? on to the reflection Adds the Rails maintenance policy to the Guides name is on the reflection, so just use the reflection decouple define_callback from the instance Added activemodel as a explicit dependency unify `Fixes` notes in AR changelog. [ci skip]. improving `reload` doc wording. #12418 [ci skip] Update AR reload doc for the case of manually set primary key attribute [ci skip]
| * we can define callbacks without a builder instanceAaron Patterson2013-10-021-1/+1
| |
| * get the name from the reflectionAaron Patterson2013-10-021-1/+1
| |
* | move habtm translation to a builder classAaron Patterson2013-10-021-0/+109
|/
* remove more mutations from the `build` methodAaron Patterson2013-08-011-7/+2
|
* Removed support for deprecated `delete_sql` in associations.Neeraj Singh2013-07-031-1/+1
|
* Removed support for deprecated `insert_sql` in associations.Neeraj Singh2013-07-021-1/+1
|
* Removed deprecated options for assocationsNeeraj Singh2013-07-021-10/+0
| | | | | Deprecated options `delete_sql`, `insert_sql`, `finder_sql` and `counter_sql` have been deleted.
* Use method compilation for association methodsJon Leighton2012-08-101-1/+1
| | | | | | | | | Method compilation provides better performance and I think the code comes out cleaner as well. A knock on effect is that methods that get redefined produce warnings. I think this is a good thing. I had to deal with a bunch of warnings coming from our tests, though.
* Unprivatise all the thingsJon Leighton2012-08-101-13/+11
| | | | | | Well, not all of them, but some of them. I don't think there's much reason for these methods to be private.
* Deprecate :finder_sql, :counter_sql, :insert_sql, :delete_sql.Jon Leighton2012-08-011-0/+10
|
* Revert "Remove :finder_sql, :counter_sql, :insert_sql, :delete_sql."Jon Leighton2012-08-011-1/+1
| | | | | | | | | 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 Leighton2012-07-201-1/+1
|
* stop using class_attribute where methods/inheritance will suffice.Jon Leighton2012-07-131-2/+6
|
* Improve the derivation of HABTM assocation join table namesAndrew White2012-06-221-30/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve the derivation of HABTM join table name to take account of nesting. It now takes the table names of the two models, sorts them lexically and then joins them, stripping any common prefix from the second table name. Some examples: Top level models (Category <=> Product) Old: categories_products New: categories_products Top level models with a global table_name_prefix (Category <=> Product) Old: site_categories_products New: site_categories_products Nested models in a module without a table_name_prefix method (Admin::Category <=> Admin::Product) Old: categories_products New: categories_products Nested models in a module with a table_name_prefix method (Admin::Category <=> Admin::Product) Old: categories_products New: admin_categories_products Nested models in a parent model (Catalog::Category <=> Catalog::Product) Old: categories_products New: catalog_categories_products Nested models in different parent models (Catalog::Category <=> Content::Page) Old: categories_pages New: catalog_categories_content_pages Also as part of this commit the validity checks for HABTM assocations have been moved to ActiveRecord::Reflection One side effect of this is to move when the exceptions are raised from the point of declaration to when the association is built. This is consistant with other association validity checks.
* no longer need #delete_all_on_destroyJon Leighton2012-05-181-1/+1
|
* Fix #3672 again (dependent: delete_all perf)Jon Leighton2011-12-141-1/+1
|
* Destroy association habtm record before destroying the record itself. Fixes ↵Tomas D'Stefano2011-07-081-12/+10
| | | | issue #402.
* Removes the restriction on primary key when joining in a habtm && test that ↵Mohammad El-Abid2011-05-261-4/+0
| | | | it was properly removed
* Make clearing of HABTM join table contents happen in an after_destory callback.Murray Steele2011-03-231-12/+12
| | | | The old method of redefining destroy meant that clearing the HABTM join table would happen as long as the call to destroy succeeded. Which meant if there was a before_destroy that stopped the instance being destroyed using normal means (returning false, raising ActiveRecord::Rollback) rather than exceptional means the join table would be cleared even though the instance wasn't destroyed. Doing it in an after_destroy hook avoids this and has the advantage of happening inside the DB transaction too.
* Use proper objects to do the work to build the associations (adding methods, ↵Jon Leighton2011-02-211-0/+63
callbacks etc) rather than calling a whole bunch of methods with rather long names.