oleg dashevskii
6974c595fd
Verify that there is no unwanted implicit readonly set on Model.has_many_through.find(id) [ #5442 state:resolved]
2010-12-23 15:19:18 -08:00
Jon Leighton
fb3a8c51b4
Raise an error for associations which try to go :through a polymorphic association [ #6212 state:resolved]
2010-12-23 15:19:18 -08:00
Jon Leighton
1c07b84df9
If a has_many goes :through a belongs_to, and the foreign key of the belongs_to changes, then the has_many should be considered stale.
2010-12-23 15:19:18 -08:00
Jon Leighton
2d9626fc74
Improved strategy for updating a belongs_to association when the foreign key changes. Rather than resetting each affected association when the foreign key changes, we should lazily check for 'staleness' (where fk does not match target id) when the association is accessed.
2010-12-23 15:19:18 -08:00
Jon Leighton
3f17ed407c
Test to verify that #2189 (count with has_many :through and a named_scope) is fixed
2010-12-23 15:19:18 -08:00
Jon Leighton
1619c2435b
Revert "Optimize <association>_ids for hm:t with belongs_to source". The optimisation has too many edge cases, such as when the reflection, source reflection, or through reflection has conditions, orders, etc. [ #6153 state:resolved]
...
This reverts commit 373b053dc8 .
Conflicts:
activerecord/lib/active_record/associations.rb
2010-12-23 15:19:18 -08:00
Jon Leighton
4e13625818
Test demonstrating problem with foo.association_ids where it's a has_many :through with :conditions, with a belongs_to as the source reflection
2010-12-23 15:19:18 -08:00
Jon Leighton
ff7bde62c8
When a has_many association is not :uniq, appending the same record multiple times should append it to the @target multiple times [ #5964 state:resolved]
2010-12-23 15:19:17 -08:00
Michał Łomnicki
030480ac1f
Fix behaviour of foo.has_many_through_association.select('custom select') [ #6089 state:resolved]
2010-12-23 15:19:17 -08:00
Szymon Nowak
85683f2a79
Fix creation of has_many through records with custom primary_key option on belongs_to [ #2990 state:resolved]
2010-12-23 15:19:17 -08:00
Will Bryant
b79823832e
Verify that has_one :through preload respects the :conditions [ #2976 state:resolved]
2010-12-23 15:19:17 -08:00
Jon Leighton
c6db37e69b
Don't allow a has_one association to go :through a collection association [ #2976 state:resolved]
2010-12-23 15:19:17 -08:00
Aaron Patterson
df3cfa6aae
avoid duping and new objects
2010-12-23 07:33:28 -08:00
Raimonds Simanovskis
2b795050de
fixed retrieval of primary key value in Ralation#insert method
...
previously primary key value was always assigned nil which caused Oracle enhanced adapter failing tests
2010-12-23 23:22:00 +08:00
Raimonds Simanovskis
d9c8c47e3d
Fix for default_scope tests to ensure comparing of equally sorted lists
...
This is additional fix for commit
ebc47465a5 Respect the default_scope on a join model when reading a through association
which otherwise was failing on Oracle (as it returned fixture comments in different order).
2010-12-23 23:19:59 +08:00
Aaron Patterson
c7f81f14df
arel can escape the id, so avoid using the database connection
2010-12-22 19:20:08 -08:00
Aaron Patterson
83ffb82fb9
Arel::Table#[] always returns an attribute, so no need for ||
2010-12-22 19:17:44 -08:00
Aaron Patterson
35f5938c91
probably should use the some_ids variable here. o_O
2010-12-22 18:30:18 -08:00
Aaron Patterson
3e64336647
removing SQL interpolation, please use scoping and attribute conditionals as a replacement
2010-12-22 18:23:38 -08:00
Aaron Patterson
6ca921a98c
use arel to compile SQL rather than build strings
2010-12-22 18:23:37 -08:00
Aaron Patterson
2de9b858a0
to_sym stuff before passing it to arel
2010-12-22 18:23:37 -08:00
Aaron Patterson
186a1b1144
build an AST rather than build SQL strings
2010-12-22 18:23:37 -08:00
Aaron Patterson
87ae85d536
returning id (for some yet to be discovered reason)
2010-12-20 19:47:15 -08:00
Aaron Patterson
207f266cca
define_attr_method must serialize nil correctly
2010-12-20 19:47:15 -08:00
Aaron Patterson
099a210c83
if there is no base name, we cannot determine a primary key
2010-12-20 19:47:15 -08:00
Aaron Patterson
0516806760
remove some lasigns
2010-12-20 19:32:14 -08:00
Aaron Patterson
3ce3c21997
no use for set, no need to to_ary, reduce extra objects
2010-12-20 14:40:07 -08:00
Aaron Patterson
6e14feb978
use array arithmetic rather than create sets
2010-12-20 14:24:04 -08:00
Jon Leighton
37b67df7e4
Avoid Symbol#to_proc for performance reasons in Ruby 1.8
2010-12-20 13:56:04 -08:00
Jon Leighton
834e5336a5
has_many associations with :dependent => :delete_all should update the counter cache when deleting records
2010-12-20 13:56:04 -08:00
Jon Leighton
57b9009893
Refactor delete_records in HasManyAssociation
2010-12-20 13:56:04 -08:00
Jon Leighton
b8153fd5a1
Fix problem where wrong keys are used in JoinAssociation when an association goes :through a belongs_to [ #2801 state:resolved]
2010-12-20 13:56:04 -08:00
Jon Leighton
9863d8a5f6
Remove unnecessary overloaded methods create, create! and create_record from HasAndBelongsToManyAssociation
2010-12-20 13:56:04 -08:00
Jon Leighton
7f5fcc0785
Refactor create_record and build_record in AssociationCollection
2010-12-20 13:56:04 -08:00
Jon Leighton
ffa57671bb
Delete create, create! and create_record from HasManyThroughAssociation in exchange for more generic versions in AssociationCollection
2010-12-20 13:56:04 -08:00
Jon Leighton
379c02267b
Specify insert_record with NotImplementedError in AssociationCollection, to indicate that subclasses should implement it. Also add save_record to reduce duplication.
2010-12-20 13:56:03 -08:00
Xavier Noria
880f8419c4
Merge branch 'master' of git://github.com/lifo/docrails
2010-12-20 20:13:34 +01:00
José Valim
0cbfd6c28d
Small changes on AD::Reloader.
2010-12-20 12:43:02 +01:00
John Firebaugh
e683ab7c39
Use AD::Reloader.to_cleanup for reloading [ #2873 state:resolved]
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-12-20 12:43:02 +01:00
John Firebaugh
435bccda93
Replace AD::Callbacks.to_prepare with AD::Reloader.to_prepare
...
Signed-off-by: José Valim <jose.valim@gmail.com >
2010-12-20 12:43:02 +01:00
Santiago Pastorino
08ccd29b5b
Remove weak_passwords list and the length/strong password validator, leave that up to the programmer
2010-12-19 15:01:29 -02:00
David Heinemeier Hansson
39b5ea6e01
Switch from SHA2 to BCrypt (easy Windows compatibility is coming shortly with new compiled gem)
2010-12-18 15:39:32 -08:00
David Heinemeier Hansson
bcf4e4f2b0
Added ActiveRecord::Base#has_secure_password (via ActiveModel::SecurePassword) to encapsulate dead-simple password usage with SHA2 encryption and salting
2010-12-18 13:38:05 -08:00
Vijay Dev
3145c8afd1
changes in examples - reflect new mailer api and mysql2 adapter
2010-12-18 01:11:58 +05:30
Santiago Pastorino
3b9120fa52
Generate add_index by default when giving type belongs_to or references
2010-12-16 20:58:58 -02:00
Piotr Sarnacki
40b15f9f38
ActiveRecord::Base.joins should allow single nil argument [ #6181 state:resolved]
2010-12-16 22:25:09 +01:00
Jon Leighton
14b880fd03
Fix various issues with the :primary_key option in :through associations [ #2421 state:resolved]
2010-12-15 17:50:14 -08:00
Jon Leighton
09ddca67ac
Fix problem with duplicated records when a :uniq :through association is preloaded [ #2447 state:resolved]
2010-12-15 17:47:42 -08:00
Aaron Patterson
6bfa846a2c
dry up compute type in attribute
2010-12-15 14:02:30 -08:00
Pavel Gorbokon
96bae30538
Replace rudimentary named_scope with scope. [ #6052 state:resolved]
...
* rename method names (actually in tests)
* rename instance variable @_named_scopes_cache to @_scopes_cache
* rename references in doc comments
* don't touch CHANGELOG :)
2010-12-15 14:02:30 -08:00