Commit Graph

20200 Commits

Author SHA1 Message Date
Jon Leighton
e8ada11aac Associations: DRY up the code which is generating conditions, and make it all use arel rather than SQL strings 2010-12-26 19:38:04 +00:00
Jon Leighton
f2230c06ed Fix dodgy tests which were effectively asserting nil == nil 2010-12-26 19:38:04 +00:00
Jon Leighton
7021b6b851 Remove custom_select param from construct_select, as it isn't used 2010-12-26 19:38:04 +00:00
Jon Leighton
d7a659334c Remove construct_from from ThroughAssociationScope - it's not called from anywhere 2010-12-26 19:38:04 +00:00
Jon Leighton
93861d19e3 Set the create scope to an empty hash in ThroughAssociationScope. For reasoning please see the inline code comments. 2010-12-26 18:46:58 +00:00
Jon Leighton
ac67eee4e6 Use conditionals and implicit returns rather than explicit returns and postfix ifs (it's easier to read) 2010-12-26 18:46:58 +00:00
Jon Leighton
739ea1fbfe Remove has_cached_counter? and cached_counter_attribute_name from HasManyThroughAssociation, as the exact same methods are inherited from HasManyAssociation 2010-12-26 18:46:58 +00:00
Jon Leighton
99db97a322 Remove pointless use of 'private' 2010-12-26 18:46:58 +00:00
Jon Leighton
3eef0977e1 Use the through association proxy for operations on the through record, so that those operations are automatically scoped and therefore construct_join_attributes does not need to use construct_owner_attributes. 2010-12-26 18:46:58 +00:00
Jon Leighton
b5c30f9dac Remove target_obsolete? which is not called from anywhere 2010-12-26 18:46:58 +00:00
Jon Leighton
c6e0433ca3 scoped.where_values_hash is never nil 2010-12-26 18:46:58 +00:00
Santiago Pastorino
57f5fe1850 Update JQuery UJS 2010-12-26 08:34:47 -02:00
Santiago Pastorino
e9a04320d7 Update Prototype UJS 2010-12-26 08:28:13 -02:00
Akira Matsuda
a329e7d9af use https to fetch files from GitHub
see: https://github.com/blog/738-sidejack-prevention-phase-2-ssl-everywhere

[#6223 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-12-26 08:20:36 -02:00
Aaron Patterson
d767252d72 refactor to use group_by 2010-12-25 16:47:59 -07:00
Aaron Patterson
bde643fbec arel will deal with casting the ids, so we can delete this 2010-12-25 16:42:49 -07:00
Aaron Patterson
75ac9c4271 use arel to determine selection column 2010-12-25 16:38:59 -07:00
Aaron Patterson
33b5a2637f refactoring method selection 2010-12-25 16:36:07 -07:00
Aaron Patterson
5b918bb97c using arel to compile sql statements 2010-12-25 16:19:59 -07:00
Aaron Patterson
0a609eea50 use sql literal factory method 2010-12-25 15:25:11 -07:00
Aaron Patterson
a6fe244e9b take more advantage of arel sql compiler 2010-12-25 15:23:45 -07:00
Aaron Patterson
3fe9951fcc refactoring AST building 2010-12-25 14:34:13 -07:00
Aaron Patterson
f855090a78 use arel to compile SQL statements 2010-12-25 14:31:22 -07:00
Aaron Patterson
ec13305b21 stop redifining methods on every call to set_primary_key 2010-12-24 22:15:41 -07:00
Aaron Patterson
23b03baba6 use the sql literal factory method 2010-12-24 16:01:07 -07:00
Aaron Patterson
0fbf829b1e stop the recursive insanity 2010-12-24 15:59:02 -07:00
Aaron Patterson
34d79fad85 setting the primary key on the update manager 2010-12-24 15:59:02 -07:00
Santiago Pastorino
2cbf948f25 Bump up rack-cache 2010-12-24 14:38:18 -02:00
Xavier Noria
8cdb758081 Merge branch 'master' of github.com:rails/rails 2010-12-24 01:55:35 +01:00
Xavier Noria
3822673151 Merge branch 'master' of git://github.com/lifo/docrails 2010-12-24 01:55:12 +01:00
Ryan Bigg
d1e95e12b4 Revert "Query guide: arel_table, eq and eq_any" along with other commits that added documentation involving the arel_table method
This reverts commit 578f9711fdb42ca9fc4b8248c494afe755cd1c17.

Conflicts:

	railties/guides/source/active_record_querying.textile
2010-12-24 10:47:38 +10:00
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 373b053dc8b99dac1abc3879a17a2bf8c30302b5.

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
Ryan Bigg
e4314e7d3f Query guide: visists => visits 2010-12-24 07:23:12 +10:00
Vijay Dev
06e2f7cd17 minor convention edit 2010-12-24 00:34:07 +05:30
Vijay Dev
f1eb69c5b2 fixing typo that crept in 2c8938f 2010-12-24 00:24:26 +05:30
Vijay Dev
5683d6883b It's JavaScript :) 2010-12-24 00:19:41 +05:30
Vijay Dev
2c8938fcba fixed inject example and some minor edits 2010-12-24 00:03:51 +05:30
José Valim
d6efd3cfc2 Don't deprecate to_prepare. 2010-12-23 19:21:14 +01:00
José Valim
819b8cae40 Clean up callbacks should also be called on exceptions. 2010-12-23 19:17:02 +01:00