- 05 1月, 2011 11 次提交
-
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
* rsim/require_deprecation: require ActiveSupport deprecatation file before using deprecate method in database_statements
-
由 Aaron Patterson 提交于
* rsim/habtm_select_fix: Explicitly select * from has_and_belongs_to_many association tables, simplify exists? query
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
由 Aaron Patterson 提交于
-
由 Pratik Naik 提交于
-
由 Prem Sichanugrist 提交于
-
由 Prem Sichanugrist 提交于
-
由 Prem Sichanugrist 提交于
-
- 04 1月, 2011 19 次提交
-
-
由 Raimonds Simanovskis 提交于
Previous version (after commit 3103296a) was generating wrong SQL for Oracle when calling exists? method on HABTM association.
-
由 Raimonds Simanovskis 提交于
otherwise when using external ActiveRecord adapters (e.g. Oracle) database_statements might be loaded before active_support/core_ext/module/deprecation which results in NoMethodError (commit 60cf65de added "deprecate" call to database_statements.rb)
-
由 Jon Leighton 提交于
Remove undocumented feature from has_one where you could pass false as the second parameter to build_assoc or create_assoc, and the existing associated object would be untouched (the foreign key would not be nullified, and it would not be deleted). If you want behaviour similar to this you can do the following things: * Use :dependent => :nullify (or don't specify :dependent) if you want to prevent the existing associated object from being deleted * Use has_many if you actually want multiple associated objects * Explicitly set the foreign key if, for some reason, you really need to have multiple objects associated with the same has_one. E.g. previous = obj.assoc obj.create_assoc previous.update_attributes(:obj_id => obj.id)
-
由 Jon Leighton 提交于
ActiveRecord::Relation#primary_key should return a string, just like ActiveRecord::Base.primary_key does.
-
由 Jon Leighton 提交于
Implement deprecated version of AssociationReflection#primary_key_name, which has been renamed to #foreign_key. Also bumping the deprecation_horizon in Active Support to 3.1.
-
由 Jon Leighton 提交于
When preloading a belongs_to, the target should still be set (to nil) if there is no foreign key present. And the loaded flag should be set on the association proxy. This then allows us to remove the foreign_key_present? check from BelongsToAssociation#find_target. Also added a test for the same thing on polymorphic associations.
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
Make Relation#create_with always merge rather than overwrite, not just when merging two relations. If you wish to overwrite, you can do relation.create_with(nil), or for a specific attribute, relation.create_with(:attr => nil).
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
Let AssociationCollection#find use #scoped to do its finding. Note that I am 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.
-
由 Jon Leighton 提交于
Fix test_any in relations_test.rb, which was failing when relations_test.rb is run on its own (it passes when the entire suite is run). This is a hacky fix for a problem I didn't quite get to the bottom of, so I'd welcome a better solution...
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
This required changing the code to keep the association proxy for a belongs_to around, despite its target being nil. Which in turn required various changes to the way that stale target checking is handled, in order to support various edge cases (loaded target is nil then foreign key added, foreign key is changed and then changed back, etc). A side effect is that the code is nicer and more succinct. Note that I am removing test_no_unexpected_aliasing since that is basically checking that the proxy for a belongs_to *does* change, which is the exact opposite of the intention of this commit. Also adding various tests for various edge cases and related things. Phew, long commit message!
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
Some basic tests for the :foreign_type option on belongs_to, which was previously completely untested.
-
由 Aaron Patterson 提交于
-
-
-
- 02 1月, 2011 2 次提交
-
-
由 Prem Sichanugrist 提交于
This will make `rails g rspec:install --help` shows "rails generate rspec:install [options]" and not "rails generate install [options]"
-
由 Aaron Patterson 提交于
* jonleighton/association_fixes: Rename AssociationReflection#primary_key_name to foreign_key, since the options key which it relates to is :foreign_key Support for :counter_cache on polymorphic belongs_to Refactor BelongsToAssociation to allow BelongsToPolymorphicAssociation to inherit from it Specify the STI type condition using SQL IN rather than a whole load of ORs. Required a fix to ActiveRecord::Relation#merge for properly merging create_with_value. This also fixes a situation where the type condition was appearing twice in the resultant SQL query. Verify that when has_many associated objects are destroyed via :dependent => :destroy, when the parent is destroyed, the callbacks are run Get rid of extra_conditions param from configure_dependency_for_has_many. I can't see a particularly plausible argument for this being used by plugins, and if they really want they can just redefine the callback or whatever. Note also that before my recent commit the extra_conditions param was completely ignored for :dependent => :destroy. And owner_quoted_id can go too Now we can drop-kick AssociationReflection#dependent_conditions into oblivion. Refactor configure_dependency_for_has_many to use AssociationCollection#delete_all. It was necessary to change test_before_destroy in lifecycle_test.rb so that it checks topic.replies.size *before* doing the destroy, as afterwards it will now (correctly) be 0.
-
- 01 1月, 2011 8 次提交
-
-
由 Santiago Pastorino 提交于
-
由 Santiago Pastorino 提交于
-
由 Jon Leighton 提交于
Rename AssociationReflection#primary_key_name to foreign_key, since the options key which it relates to is :foreign_key
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
Specify the STI type condition using SQL IN rather than a whole load of ORs. Required a fix to ActiveRecord::Relation#merge for properly merging create_with_value. This also fixes a situation where the type condition was appearing twice in the resultant SQL query.
-
由 Jon Leighton 提交于
Verify that when has_many associated objects are destroyed via :dependent => :destroy, when the parent is destroyed, the callbacks are run
-
由 Jon Leighton 提交于
Get rid of extra_conditions param from configure_dependency_for_has_many. I can't see a particularly plausible argument for this being used by plugins, and if they really want they can just redefine the callback or whatever. Note also that before my recent commit the extra_conditions param was completely ignored for :dependent => :destroy.
-