Commit Graph

4236 Commits

Author SHA1 Message Date
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
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
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
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
Aaron Patterson
dc11a77ab7 write the delegate method directly to avoid delegate callstack overhead 2011-01-14 14:40:11 -08:00
Aaron Patterson
ef4ffed660 reduce some lasigns 2011-01-14 14:30:47 -08:00
Aaron Patterson
92499b3c7e Arel::Table.engine will be deprecated, so stop using it 2011-01-14 13:11:24 -08:00
Aaron Patterson
3165dca28c include_in_memory? should check against @target list in case of new records. [#6257 state:resolved] 2011-01-12 18:07:53 -08:00
Aaron Patterson
e1beb7d287 use array maths rather than *args 2011-01-12 15:15:45 -08:00
Aaron Patterson
8f9944d5bc just use return value of load_target 2011-01-12 14:29:17 -08:00
Aaron Patterson
e9980f17fd just call methods on return value of load_target 2011-01-12 14:27:08 -08:00
Aaron Patterson
bc993c690b default return value is nil 2011-01-12 14:27:08 -08:00
Aaron Patterson
49696e0a62 @loaded is defined in initialize, so we should not need this 2011-01-12 14:27:08 -08:00
Aaron Patterson
8bee98fe3a just use respond_to? and super rather than aliasing around methods 2011-01-12 14:27:08 -08:00
Aaron Patterson
f8700038af adding a test for no method error 2011-01-11 17:57:02 -08:00
Aaron Patterson
fcd8925f23 use underlying _read_attribute method rather than causing NoMethodErrors 2011-01-11 15:39:26 -08:00
Aaron Patterson
5696d948ed kill unused variable warnings 2011-01-11 15:29:35 -08:00
Aaron Patterson
8c71e8b18f lazily instantiate AR objects in order to avoid NoMethodErrors 2011-01-11 15:16:09 -08:00
Jon Leighton
af96018c91 test_with_polymorphic_and_condition works without the conditions methods in BelongsToPolymorphicAssociation because the conditions are added straight to the association_scope as of a few days ago 2011-01-11 13:45:09 -08:00
Jon Leighton
552df9b933 Support for create_association! for has_one associations 2011-01-11 13:45:09 -08:00
Jon Leighton
d88caa6e4a Refactor the code for singular association constructors. This will allow me to define a create_association! method in a minute. 2011-01-11 13:45:09 -08:00
Jon Leighton
f4a88e810f It's not necessary to pass the association proxy class around now 2011-01-11 13:45:09 -08:00
Jon Leighton
681ab53ba1 Get rid of set_association_target and association_loaded? as the parts of the code that need that can now just use association_proxy(:name).loaded?/target= 2011-01-11 13:45:08 -08:00
Jon Leighton
42b2e4f85b We can use the association_proxy method directly in HasOneThroughAssociation now 2011-01-11 13:45:08 -08:00