Commit Graph

5238 Commits

Author SHA1 Message Date
Jon Leighton
1a4bbaf106 Use scoped.first and scoped.last instead of find(:first, ...) and find(:last, ...) 2011-01-30 11:58:07 +00:00
Jon Leighton
1e7cf6c7e9 Try to make fetch_first_or_last_using_find? more readable 2011-01-30 11:58:07 +00:00
Jon Leighton
db503c4142 load_target returns the target 2011-01-30 11:56:41 +00:00
Jon Leighton
aa86420be2 Rename AssociationProxy#loaded to loaded! as it mutates the association 2011-01-30 11:56:41 +00:00
Jon Leighton
de05e2fb15 Abstract load_target conditional logic 2011-01-30 11:56:41 +00:00
Jon Leighton
d392c67d2c Remove unused methods conditions, sql_conditions and sanitize_sql 2011-01-30 11:56:41 +00:00
Jon Leighton
dbb6fa723e Don't pass around conditions as strings in ThroughAssociation 2011-01-30 11:56:41 +00:00
Jon Leighton
d85ee50eda Indent methods under private/protected sections 2011-01-30 11:56:41 +00:00
Jon Leighton
15601c52e7 Let's be less blasé about method visibility on association proxies 2011-01-30 11:56:41 +00:00
Jon Leighton
63c73dd021 We shouldn't be using scoped.scoping { ... } to build associated records, as this can affect validations/callbacks/etc inside the record itself [#6252 state:resolved] 2011-01-30 11:56:41 +00:00
Aaron Patterson
740bc35d32 always return the identity function from type_cast_code 2011-01-28 18:04:22 -08:00
Aaron Patterson
72c1818941 use an identity conversion to avoid conditional codes 2011-01-28 17:39:38 -08:00
Alexey Nayden
fa779c5357 Fixing incorrectly writtent testcase 2011-01-28 15:06:02 -08:00
Alexey Nayden
e92c2ffd8e Nested attributes and in-memory changed values #first and #[] behaviour consistency fix 2011-01-28 15:06:01 -08:00
Alexey Nayden
2884482c34 test_first_and_array_index_zero_methods_return_the_same_value_when_nested_attributes_are_set_to_update_existing_record added 2011-01-28 15:06:01 -08:00
Aaron Patterson
59f3218463 load and prefer psych as the YAML parser when it is available 2011-01-21 17:53:28 -08:00
Xavier Noria
236f1f52cd Merge branch 'master' of git://github.com/lifo/docrails 2011-01-20 10:33:38 +01:00
Aaron Patterson
a282301a77 we have a method for setting preloaded records, so use it 2011-01-18 16:33:18 -08:00
Aaron Patterson
c107849a99 reduce objects, reduce loops and function calls while building the conditional 2011-01-18 15:52:57 -08:00
Aaron Patterson
f3a5995bbf keys will always be strings in the id => record map 2011-01-18 15:52:57 -08:00
Aaron Patterson
9e42f1b416 reduce method calls and loops when dealing with custom conditions 2011-01-18 15:52:57 -08:00
Aaron Patterson
ba62a87b8b ony bother with record map keys when we need them 2011-01-18 15:52:57 -08:00
Aaron Patterson
4bc9bacd94 refactor elaborate group_by in to a normal group_by 2011-01-18 15:52:57 -08:00
Aaron Patterson
e6881217ed fixing bug where 1.8 hangs while running pg tests 2011-01-18 10:49:50 -08:00
Aaron Patterson
11fe2161ce remove unnecessary module_eval 2011-01-18 09:36:33 -08:00
Aaron Patterson
9d549986dd remove useless conditional 2011-01-17 16:42:34 -08:00
Jaime Iniesta
4b7dad2df3 ActiveRecord#save(false) is now deprecated, now it is save(:validate => false) 2011-01-18 00:35:07 +01:00
Aaron Patterson
fdfabc99e8 fixing unused variable warnings 2011-01-17 14:22:17 -08:00
Jon Leighton
7a3f05f43d Add CHANGELOG entry for the addition of create_association! methods on has_one and belongs_to 2011-01-16 13:43:54 -08:00
Jon Leighton
d1521719c5 Removed support for accessing attributes on a has_and_belongs_to_many join table. This has been documented as deprecated behaviour since April 2006. Please use has_many :through instead. A deprecation warning will be added to the 3-0-stable branch for the 3.0.4 release. 2011-01-16 13:43:54 -08:00
Jon Leighton
c4458b3602 Rename some variables 2011-01-16 13:43:54 -08:00
Jon Leighton
8aedd722e1 Use self.target= in HasOneThroughAssociation too 2011-01-16 13:43:54 -08:00
Jon Leighton
b7594a0756 find_target can also go into SingularAssociation 2011-01-16 13:43:53 -08:00
Jon Leighton
f1a15c2197 Abstract a bit more into SingularAssociation 2011-01-16 13:43:53 -08:00
Jon Leighton
115eedbb41 Use self.target= rather than @target= as the former automatically sets loaded 2011-01-16 13:43:53 -08:00
Jon Leighton
ef79b91784 Abstract common code from BelongsToAssociation and HasOneAssociation into SingularAssociation 2011-01-16 13:43:53 -08:00
Jon Leighton
bf24fe810c belongs_to records should be initialized within the association scope 2011-01-16 13:43:53 -08:00
Jon Leighton
3ef693724c Document the new create_association! method on one-to-one associations 2011-01-16 13:43:53 -08:00
Jon Leighton
52c47556b7 Add create_association! for belongs_to 2011-01-16 13:43:53 -08:00
Xavier Noria
15e71347f6 updates AR's CHANGELOG with changes in 9e64dfa and ad343d7 2011-01-16 18:55:35 +01:00
Aaron Patterson
0aef847927 push !loaded? conditional up 2011-01-14 17:08:27 -08:00
Aaron Patterson
b8ed2d5ddf return early in case the left or right side lists are empty 2011-01-14 17:03:15 -08:00
Aaron Patterson
75e29e871e only find_target can raise the exception, so isolate the rescue around that call 2011-01-14 16:57:14 -08:00
Aaron Patterson
f548054700 we always have a target, so stop checking 2011-01-14 16:54:02 -08:00
Aaron Patterson
f5d2cb9cac we should use [] instead of Array.new 2011-01-14 16:50:26 -08:00
Aaron Patterson
17687e4f96 @target is always a list, so stop doing is_a? checks 2011-01-14 16:47:31 -08:00
Aaron Patterson
2afd6c75f1 move complex logic to it's own method 2011-01-14 16:46:02 -08:00
Jordi Romero
b31ef7ee83 document ActiveRecord's except and only
Document methods that allow easily override arel queries
2011-01-15 01:17:53 +01:00
Aaron Patterson
a0a69b045a loaded? will not raise an AR::RecordNotFound exception, so move the rescue inside the conditional 2011-01-14 15:58:59 -08:00
Aaron Patterson
c326969745 reduce funcalls by using falsey objects 2011-01-14 14:45:46 -08:00