aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
Commit message (Collapse)AuthorAgeFilesLines
* Replace inline lambdas with named methodsJon Leighton2011-06-121-29/+42
|
* Don't wrap operations on collection associations in transactions when they ↵benedikt2011-06-121-3/+9
| | | | are not needed, so the connection adapter does not send empty BEGIN COMMIT transactions blocks to the database.
* remove warning: assigned but unused variableSantiago Pastorino2011-06-081-1/+1
|
* Allow polymorphic has_one to work when the association is set before the ↵Jon Leighton2011-06-081-3/+1
| | | | owner has been saved. Fixes #1524.
* When you add a record to a polymorphic has_one, you should be able to access ↵Jon Leighton2011-06-082-2/+2
| | | | the owner from the associated record
* Don't double assign attributes - closes #1467.Andrew White2011-06-031-1/+0
|
* added an alias for new to build to the AR collection proxy, this corrects an ↵Josh Kalderimis2011-06-012-10/+2
| | | | issue where the collection proxies were not consistent
* Only save the record once when calling create! on a collection association. ↵Jon Leighton2011-05-314-25/+45
| | | | Fixes #1360.
* Implementing @dmathieu's cleaner fix from #1425. Unfortunately he deleted ↵Jon Leighton2011-05-311-8/+5
| | | | the branch so I cannot just merge it.
* Adding comment to work with 1.8.7. Nested Attribute fix.Arun Agrawal2011-05-311-0/+3
|
* Fix nested attribute for memory record.Arun Agrawal2011-05-311-1/+5
|
* Merge pull request #1323 from fx/association_primary_keyJon Leighton2011-05-261-1/+1
|\ | | | | use association_primary_key in AssociationScope#add_constraints
| * use association_primary_key in AssociationScope#add_constraintsMarian Rudzynski2011-05-261-1/+1
| |
* | Removes the restriction on primary key when joining in a habtm && test that ↵Mohammad El-Abid2011-05-261-4/+0
|/ | | | it was properly removed
* Merge branch 'master' of github.com:rails/railsXavier Noria2011-05-252-37/+0
|\
| * removed deprecated methods, and related tests, from ActiveRecordJosh Kalderimis2011-05-252-37/+0
| |
* | Merge branch 'master' of git://github.com/lifo/docrailsXavier Noria2011-05-252-2/+2
|\ \ | |/ |/| | | | | | | Conflicts: actionmailer/lib/action_mailer/base.rb activesupport/lib/active_support/core_ext/kernel/requires.rb
| * Remove extra white spaces on ActiveRecord docs.Sebastian Martinez2011-05-232-2/+2
| |
* | Ignore :includes on through associationsAndrew White2011-05-241-1/+1
| |
* | Fix problem with loading polymorphic associations which have been defined in ↵Jon Leighton2011-05-222-8/+22
| | | | | | | | an abstract superclass. Fixes #552.
* | Handle polymorphic_type NOT NULL-able columns as well.thedarkone2011-05-211-1/+1
| |
* | AliasTracker.pluralize use pluralize_table_names of modelGuillermo Iguaran2011-05-202-3/+3
| |
* | Implement proxy_owner, proxy_target and proxy_reflection methods on ↵Jon Leighton2011-05-191-0/+24
|/ | | | CollectionProxy with deprecations. Fixes #1148.
* Don't pass a block as we are yieldingAndrew White2011-05-171-1/+1
|
* Add block setting of attributes to singular associationsAndrew White2011-05-172-11/+12
|
* Pass the attribute and option hashes to build_associationAndrew White2011-05-172-8/+12
| | | | | | | The build_association method was added as an API for plugins to hook into in 1398db0. This commit restores this API and the ability to override class.new to return a subclass based on a virtual attribute in the attributes hash.
* Merge pull request #560 from guilleiguaran/fix_pluralize_table_names_falseJon Leighton2011-05-161-1/+1
|\ | | | | Fixing has_many when ActiveRecord::Base.pluralize_table_names is false
| * Fixing has_many association when ActiveRecord::Base.pluralize_table_names is ↵Guillermo Iguaran2011-05-151-1/+1
| | | | | | | | false. fixes #557
* | These extra array operations appear to be unnecessary. Reasoning:Jon Leighton2011-05-141-8/+2
| | | | | | | | | | * It is not necessary to subtract 'id' from the list of copied attributes because record and mem_record are equal, so therefore their id attributes are also equal (so there is no harm in copying it, and this reduces the complexity of the code) * It is not necessary to intersect the attribute names, since record and mem_record are equal, so they have the same id and class, so they have the same columns in the database. If record has non-column attributes then it seems reasonable to also copy them onto mem_record (though I am not sure what situation this would ever happen in)
* | CollectionAssociation#merge_target_lists should write to the underlying ↵Jon Leighton2011-05-141-5/+2
| | | | | | | | attributes when copying, rather than using the assignment method
* | An attempt to make CollectionAssociation#merge_target_lists make more sense.Jon Leighton2011-05-141-16/+35
|/
* Instead of doing find(:all) which does scoped.find(:all) which does ↵Jon Leighton2011-05-131-1/+1
| | | | scoped.all, just do scoped.all.
* Remove pointless rescue (it doesn't happen anywhere in the tests, and I ↵Jon Leighton2011-05-131-9/+1
| | | | can't see a way that it would happen ever)
* Don't use mass-assignment protection when setting foreign keys or ↵Jon Leighton2011-05-121-9/+9
| | | | association conditions on singular associations. Fixes #481 (again).
* Don't remove the target if it has already been destroyedAndrew White2011-05-111-1/+1
|
* Modified CollectionAssociation to refer to the new class name.Michael Ebens2011-05-111-1/+1
|
* Don't use select() values from the join model of a through association. ↵Jon Leighton2011-05-111-3/+4
| | | | Fixes #508.
* Bring back obj.association_loaded? as a deprecated method. Fixes #472.Jon Leighton2011-05-111-0/+13
|
* Remove unnecessary '|| {}'Jon Leighton2011-05-101-1/+1
|
* Don't use mass-assignment protection when applying the ↵Jon Leighton2011-05-102-3/+7
| | | | scoped.scope_for_create. Fixes #481.
* Fix #480. Passing nil to create association works.José Valim2011-05-101-1/+1
|
* Revert "b9ea751d0e56bd00d341766977a607ed3f7ddd0f".José Valim2011-05-101-26/+27
| | | | | Wrapping each Record.associations.build in a transaction is going to make several unneeded queries. Reverting this commit also fixes #479.
* Merge pull request #399 from ernie/join_conditions_on_joinJon Leighton2011-05-051-3/+3
|\ | | | | Add association join conditions to JOIN clause, not WHERE
| * Add join conditions to JOIN clause, not WHEREErnie Miller2011-05-051-3/+3
| |
* | Merge pull request #358 from baroquebobcat/fix_find_or_create_masterAaron Patterson2011-05-051-3/+6
|\ \ | |/ |/| Fix for lighthouse #6741
| * Fix for lighthouse #6741Nick Howard2011-05-011-3/+6
| | | | | | | | | | | | | | - adds tests for find_or_create_by and find_or_initialize_by on has_many associations - changes the behavior of ActiveRecord::Associations::CollectionProxy#method_missing to differ to ActiveRecord::FinderMethods#find_or_instantiator_by_attributes for arg processing and saving so find_or_create_by's api on associations will be consistent w/ the api for model classes.
* | singular and collection relations in AR can now specify mass-assignment ↵Josh Kalderimis2011-05-013-20/+20
|/ | | | security options (:as and :without_protection) in build, create and create! methods.
* Extract the constraint-building for joins in JoinAssociation into a separate ↵Jon Leighton2011-04-141-8/+14
| | | | method to make it easy to change/override (requested by Ernie Miller so that MetaWhere can add to it easily)
* Remove `#among?` from Active SupportPrem Sichanugrist2011-04-135-5/+5
| | | | | | After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now. It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
* Removing the scope-caching which happens on association proxies, because the ↵Jon Leighton2011-04-122-14/+0
| | | | query is already cached by the query cacher. For formalised proof see http://www.youtube.com/watch?v=wDefXLb-FDs