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 |
|
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
|
2947197421
|
use rake to create test databases for us
|
2011-01-14 14:07:16 -08:00 |
|
Aaron Patterson
|
f30a3106f3
|
transactional fixtures must be set to false for this test
|
2011-01-14 13:45:30 -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
|
1e9685f159
|
preheat the table cache in arel
|
2011-01-14 11:16:31 -08:00 |
|
Santiago Pastorino
|
3755ae04a1
|
Add missing require
|
2011-01-14 17:11:15 -02:00 |
|
Santiago Pastorino
|
9a57a2279e
|
sorry, the CI cannot lie to us anymore (Part II)
|
2011-01-13 10:55:41 -02: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 |
|
Jon Leighton
|
3b797c8c86
|
DRY up the code which instantiates the association proxy
|
2011-01-11 13:45:08 -08:00 |
|
Jon Leighton
|
4754018272
|
find_target can be inherited
|
2011-01-11 13:45:07 -08:00 |
|
Jon Leighton
|
9086b02ba5
|
Document the recent changes to association assignment
|
2011-01-11 13:45:07 -08:00 |
|
Jon Leighton
|
6055bbedaa
|
Raise ActiveRecord::RecordNotSaved if an AssociationCollection fails to be replaced
|
2011-01-11 13:45:07 -08:00 |
|
Jon Leighton
|
1d6e218428
|
When assigning a has_one, if anything fails, the assignment should be rolled back entirely
|
2011-01-11 13:45:07 -08:00 |
|
Jon Leighton
|
4e19ec566c
|
In a number of places in the tests, we only need to turn off transactional fixtures when the DB does not support savepoints. This speeds the test run up by about 8-9% on my computer, when running rake test_sqlite3_mem :)
|
2011-01-11 13:45:07 -08:00 |
|
Jon Leighton
|
29452abb84
|
SQLite3 has supported savepoints since version 3.6.8, we should use this!
|
2011-01-11 13:45:07 -08:00 |
|
Jon Leighton
|
7f7b480098
|
When assigning a has_one, if the new record fails to save, raise an error
|
2011-01-11 13:45:07 -08:00 |
|
Jon Leighton
|
1bc71ed960
|
When assigning a has_one, if the existing record fails to be removed from the association, raise an error
|
2011-01-11 13:45:06 -08:00 |
|
Jon Leighton
|
c47c541402
|
Have a separate test connection directory for sqlite3 in-memory so that the tests can be run without having to specifically rename the connection file (which then causes git to pick up the changes)
|
2011-01-11 13:45:06 -08:00 |
|
Jon Leighton
|
80df74bf51
|
Enable the sqlite3 in-memory test connection to work
|
2011-01-11 13:45:06 -08:00 |
|
Jon Leighton
|
c6e10b0f60
|
has_one should always remove the old record (properly), even if not saving the new record, so we don't get the database into a pickle
|
2011-01-11 13:45:06 -08:00 |
|
Jon Leighton
|
665880c080
|
Return value is irrelevant here as the RHS of the assignment is always returned by methods ending in '='
|
2011-01-11 13:45:06 -08:00 |
|
Jon Leighton
|
15adcc3927
|
Remove incorrect documentation about build_assoc on has_one. This is proven, for example, by test_successful_build_association in has_one_associations_test.rb
|
2011-01-11 13:45:06 -08:00 |
|
Jon Leighton
|
00dc8f77a2
|
For a singular association, it should be build_association, rather than association.build (as association may be nil)
|
2011-01-11 13:45:06 -08:00 |
|
Jon Leighton
|
1390a44328
|
Correctly indent the bullet points under 'One-to-one associations', so that the lines are not broken in the generated rdoc html
|
2011-01-11 13:45:05 -08:00 |
|