aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/builder
Commit message (Collapse)AuthorAgeFilesLines
* Ensure that associations have a symbol argument.Steve Klabnik2012-11-281-0/+2
| | | | Fixes #7418.
* Merge pull request #8116 from senny/7993_configure_counter_cache_for_has_manyJon Leighton2012-11-091-1/+1
|\ | | | | :counter_cache option for to support custom named counter caches
| * :counter_cache option for to support custom named counter caches. Closes #7993Yves Senn2012-11-041-1/+1
| |
* | adding requires for constant dependenciesAaron Patterson2012-11-071-0/+3
|/
* Use method compilation for association methodsJon Leighton2012-08-105-64/+62
| | | | | | | | | 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.
* DRY up handling of dependent optionJon Leighton2012-08-105-63/+22
|
* Unprivatise all the thingsJon Leighton2012-08-107-170/+156
| | | | | | Well, not all of them, but some of them. I don't think there's much reason for these methods to be private.
* move dependency logic out of generated methodsJon Leighton2012-08-104-65/+19
|
* Clean up dependent option validation.Jon Leighton2012-08-104-14/+7
| | | | | We don't need the complexity of to_sentence, and it shouldn't be a bang method.
* Remove the dependent_restrict_raises option.Jon Leighton2012-08-103-23/+22
| | | | | | | | | | | | | | | It's not really a good idea to have this as a global config option. We should allow people to specify the behaviour per association. There will now be two new values: * :dependent => :restrict_with_exception implements the current behaviour of :restrict. :restrict itself is deprecated in favour of :restrict_with_exception. * :dependent => :restrict_with_error implements the new behaviour - it adds an error to the owner if there are dependent records present See #4727 for the original discussion of this.
* load active_support/deprecation in active_support/railsXavier Noria2012-08-021-1/+0
|
* load active_support/core_ext/object/inclusion in active_support/railsXavier Noria2012-08-023-3/+0
|
* Deprecate :finder_sql, :counter_sql, :insert_sql, :delete_sql.Jon Leighton2012-08-012-0/+21
|
* Revert "Remove :finder_sql, :counter_sql, :insert_sql, :delete_sql."Jon Leighton2012-08-012-2/+2
| | | | | | | | | This reverts commit 3803fcce26b837c0117f7d278b83c366dc4ed370. Conflicts: activerecord/CHANGELOG.md It will be deprecated only in 4.0, and removed properly in 4.1.
* Refactor dependency check validationCarlos Antonio da Silva2012-08-014-28/+19
| | | | | | Move the logic for validation check to the same method, and cache dependent option in a variable to reuse inside the dependency configuration methods instead of relying on the options hash.
* move method for dependent option checkHrvoje Šimić2012-08-014-11/+22
|
* Remove :finder_sql, :counter_sql, :insert_sql, :delete_sql.Jon Leighton2012-07-202-2/+2
|
* Avoid options ever being nilJon Leighton2012-07-201-4/+4
| | | | This fixes active_record_deprecated_finders.
* fix association :extend optionJon Leighton2012-07-132-6/+17
|
* move the deprecated options into active_record_deprecated_findersJon Leighton2012-07-132-5/+2
|
* stop using class_attribute where methods/inheritance will suffice.Jon Leighton2012-07-137-29/+53
|
* extract deprecated association options to active_record_deprecated_findersJon Leighton2012-07-131-43/+0
|
* Represent association scope options as AR::Relations insternally.Jon Leighton2012-07-131-0/+43
|
* Allow associations to take a lambda which builds the scopeJon Leighton2012-07-132-12/+17
|
* 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.
* Merge pull request #4835 from ↵Carlos Antonio da Silva2012-05-191-3/+3
|\ | | | | | | | | pacoguzman/refactor_define_restrict_dependency_method Refactor define_restrict_dependency_method using reflection
| * Refactor define_restrict_dependency_method using reflectionPaco Guzman2012-02-011-3/+3
| |
* | no longer need #delete_all_on_destroyJon Leighton2012-05-182-2/+2
|/
* Use human attribute name to show the dependent destroy messageRafael Mendonça França2012-02-011-1/+2
|
* fix has_one, has_many restrict error messageManoj2012-02-011-1/+2
|
* Merge pull request #4799 from arunagw/warning_fixed_for_indentationsAaron Patterson2012-01-311-1/+1
|\ | | | | warning removed: mismatched indentations
| * warning removed: mismatched indentationsArun Agrawal2012-01-311-1/+1
| |
* | Put spaces between the words at deprecation warningRafael Mendonça França2012-01-311-3/+3
|/
* suggested fixes for :dependent => :restrict deprecation.Manoj2012-01-311-1/+1
|
* Same method for has_many and has_one associationsPaco Guzman2012-01-313-30/+17
|
* Easy dependent_restrict error messagePaco Guzman2012-01-312-4/+2
|
* has_many/has_one, :dependent => :restrict, deprecation added.Manoj2012-01-293-3/+35
|
* Deprecate inferred JOINs with includes + SQL snippets.Jon Leighton2012-01-161-1/+1
| | | | | | See the CHANGELOG for details. Fixes #950.
* Revert "Deprecate implicit eager loading. Closes #950."Jon Leighton2012-01-161-1/+1
| | | | This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9.
* Remove Array.wrap calls in ActiveRecordRafael Mendonça França2012-01-061-2/+2
|
* Removed metaclass from the has_many dependency destroy method. Fixes #2954Dmitry Polushkin2011-12-312-8/+5
|
* Deprecate implicit eager loading. Closes #950.Jon Leighton2011-12-291-1/+1
|
* Fix #3672 again (dependent: delete_all perf)Jon Leighton2011-12-142-2/+8
|
* avoid warningsJosh Susser2011-11-276-15/+15
| | | | | | | This change uses Module.redefine_method as defined in ActiveSupport. Making Module.define_method public would be as clean in the code, and would also emit warnings when redefining an association. That is pretty messy given current tests, so I'm leaving it for someone else to decide what approach is better.
* use GeneratedFeatureMethods module for associationsJosh Susser2011-11-272-7/+13
|
* association methods are now generated in modulesJosh Susser2011-11-157-30/+25
| | | | | | | | | | Instead of generating association methods directly in the model class, they are generated in an anonymous module which is then included in the model class. There is one such module for each association. The only subtlety is that the generated_attributes_methods module (from ActiveModel) must be forced to be included before association methods are created so that attribute methods will not shadow association methods.
* 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
* removed deprecated methods, and related tests, from ActiveRecordJosh Kalderimis2011-05-251-13/+0
|
* Add block setting of attributes to singular associationsAndrew White2011-05-171-6/+6
|