Jeremy Kemper
d5354af114
Fix backward compatibility with stored Hash values. Wrap coders to convert serialized values to indifferent access.
2012-05-30 23:21:57 -07:00
Nick Rogers
2931f413a5
Tests for removing a HABTM association when optimistic locking is enabled.
2012-03-07 23:56:23 -05:00
Rick Martinez
30b6d4f7f1
added test for #3732
2012-02-10 17:35:22 -05:00
Nathan Broadbent
b31eac5609
Replaced all 'for' loops with Enumerable#each
2012-01-30 03:15:49 +08:00
David Peter
ee013a503d
Fix bug where reset_counters resets the wrong counter cache.
...
If a model belongs_to two associations with the same class, then reset_counters
will reset the wrong counter cache.
Finding the right reflection should use the foreign_key instead, which should
be unique.
2012-01-16 19:06:45 -08:00
Alexey Muranov
6468ff4197
Test fixtures with custom model and table names
...
Test using fixtures with random names and model names, that is not following naming conventions but using set_fixture_class instead.
It is expected that the table name be defined in the model, but this is not explicitly tested here. This will need to be fixed.
2011-12-30 10:34:01 +01:00
Alexey Muranov
ae8bb11842
Fix a fixtures test case with table prefix/suffix
...
Make sure the table name of a model is reset in a test case after assigning ActiveRecord::Base.table_name_prefix and ActiveRecord::Base.table_name_suffix.
2011-12-27 02:17:31 +01:00
Jon Leighton
649869557a
Fixtures support for ActiveRecord::Model
2011-12-24 11:08:15 +00:00
Jon Leighton
91681c281b
Revert "Merge pull request #4114 from alexeymuranov/my_fix_for_prefix_suffix_fixtures_test"
...
This reverts commit f8e484d0f71114675ed04e987914d3f2815cb868, reversing
changes made to fa5adfb1e884bf21a7071ade634a820e37ac4db4.
Reason: broke the postgres tests.
2011-12-22 17:04:01 +00:00
Alexey Muranov
adb917a0d8
Fix a fixtures test case with table prefix/suffix
...
Make sure the table name of a model is reset in a test case after assigning ActiveRecord::Base.table_name_prefix and ActiveRecord::Base.table_name_suffix. This was somebody else's test case, so an independent opinion on the change can be helpful.
2011-12-22 15:07:45 +01:00
Xavier Noria
0a38e2a5ce
restores the API docs of AR::Fixtures, made a quick pass over them, revises link in fixture template [ closes #2840 ]
2011-09-03 15:20:30 -07:00
Jon Leighton
f000d4e5fa
Quote these dates to prevent intermittent test failure. Suppose local time is 00:50 GMT+1. Without the quoting, the YAML parser would parse this as 00:50 UTC, into the local time of 01:50 GMT+1. Then, it would get written into the database in local time as 01:50. When it came back out the UTC date from the database and the UTC date of two weeks ago would be compared. The former would be 23:50, and the latter would be 00:50, so the two dates would differ, causing the assertion to fail. Quoting it prevents the YAML parser from getting involved.
2011-08-04 00:38:27 +01:00
Aaron Patterson
d8736b266b
Revert "this fixes a brittle test in fixtures_test.rb which fails when you are in a timezone which is ahead of UTC but UTC is in the previous day still."
...
This reverts commit f92cefa95f44bcd550c402a7f5ba914f3bd783cc.
2011-07-20 15:37:52 -07:00
Josh Kalderimis
f92cefa95f
this fixes a brittle test in fixtures_test.rb which fails when you are in a timezone which is ahead of UTC but UTC is in the previous day still.
2011-07-20 01:00:35 +02:00
Jon Leighton
ac97e25235
Revert "Fix failure in test_preserves_existing_fixture_data from test/cases/fixtures_test.rb when UTC and local time occur on different dates." I am pretty sure this was an incorrect fix, and it still failed in certain circumstances anyway. I am now unable to reproduce the original failure I was experiencing so will leave it for now and see if this pops up again.
...
This reverts commit e4479b2f1bc54edf155408d51dd3236955150ce1.
2011-07-17 19:55:05 +01:00
Jon Leighton
e4479b2f1b
Fix failure in test_preserves_existing_fixture_data from test/cases/fixtures_test.rb when UTC and local time occur on different dates.
2011-07-12 00:14:45 +01:00
dmathieu
79dc275b8d
properly reference yml alias nodes
...
as per the last version of the yml specifications : http://www.yaml.org/spec/1.2/spec.html# * alias//
2011-05-24 11:18:28 +02:00
Aaron Patterson
5ec23b95ba
fixing 1.8 support for new fixture tests
2011-05-23 15:06:13 -07:00
Jon Leighton
1dd90f8f12
Don't use select() values from the join model of a through association. Fixes #508 .
2011-05-11 08:56:01 +01:00
Aaron Patterson
558334a899
deprecating CSV fixture support
2011-05-10 11:08:18 -07:00
Christopher Meiklejohn
4fbd8adf48
Don't quote ID's as Arel will quote them -- follow same conventions as the delete method.
2011-05-08 18:37:28 +01:00
Jason Noble
7db2ef47a1
Namespace Fixtures in ActiveRecord
...
[Fixes #439 ]
2011-05-07 14:20:51 -06:00
Jon Leighton
582edaa1ff
Merge branch 'master' into nested_has_many_through
2011-03-10 19:35:20 +00:00
Xavier Noria
f41dd99be7
revises links to the API websites of individual components (no longer maintained), and rewrites the section about after and around filters in the controller guide
2011-03-09 07:43:18 +01:00
Jon Leighton
ddf83d14f1
Add a test for STI on the through where the through is nested, and change the code which support this
2011-03-05 20:10:24 +00:00
Jon Leighton
735844db71
Merge branch 'master' into nested_has_many_through
...
Conflicts:
activerecord/CHANGELOG
activerecord/lib/active_record/association_preload.rb
activerecord/lib/active_record/associations.rb
activerecord/lib/active_record/associations/class_methods/join_dependency.rb
activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb
activerecord/lib/active_record/associations/has_many_association.rb
activerecord/lib/active_record/associations/has_many_through_association.rb
activerecord/lib/active_record/associations/has_one_association.rb
activerecord/lib/active_record/associations/has_one_through_association.rb
activerecord/lib/active_record/associations/through_association_scope.rb
activerecord/lib/active_record/reflection.rb
activerecord/test/cases/associations/has_many_through_associations_test.rb
activerecord/test/cases/associations/has_one_through_associations_test.rb
activerecord/test/cases/reflection_test.rb
activerecord/test/cases/relations_test.rb
activerecord/test/fixtures/memberships.yml
activerecord/test/models/categorization.rb
activerecord/test/models/category.rb
activerecord/test/models/member.rb
activerecord/test/models/reference.rb
activerecord/test/models/tagging.rb
2011-03-04 09:30:27 +00:00
Emilio Tagua
8ee0b44148
Merge remote branch 'rails/master' into identity_map
...
Conflicts:
activerecord/examples/performance.rb
activerecord/lib/active_record/association_preload.rb
activerecord/lib/active_record/associations.rb
activerecord/lib/active_record/associations/association_proxy.rb
activerecord/lib/active_record/autosave_association.rb
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/nested_attributes.rb
activerecord/test/cases/relations_test.rb
2011-02-15 12:01:04 -03:00
Jon Leighton
52f09eac5b
Correctly update counter caches on deletion for has_many :through [ #2824 state:resolved]. Also fixed a bunch of other counter cache bugs in the process, as once I fixed this one others started appearing like nobody's business.
2011-02-07 23:35:05 +00: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
Pratik Naik
fd1cf13f74
Make serialized fixtures work again
2010-12-29 16:15:45 +00:00
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
Aaron Patterson
5b918bb97c
using arel to compile sql statements
2010-12-25 16:19:59 -07: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
Marcin Raczkowski
ce3ea558ab
IdentityMap - Tests for IM
2010-11-19 19:03:56 -03:00
Jon Leighton
915ea5ea82
Support the :primary_key option on a through reflection in a nested through association
2010-10-19 16:13:06 +01:00
Jon Leighton
01838636c6
Support for :primary_key option on the source reflection of a through association, where the source is a has_one or has_many
2010-10-19 14:14:06 +01:00
Jon Leighton
596cc3b232
Respect the :primary_key option on the through_reflection of (non-nested) through associations
2010-10-19 12:47:19 +01:00
Jon Leighton
9ec0734874
Properly support conditions on any of the reflections involved in a nested through association
2010-10-19 00:27:40 +01:00
Jon Leighton
002985fb66
Add test_has_one_through_has_one_through_with_belongs_to_source_reflection
2010-10-14 13:44:32 +01:00
Jon Leighton
bc821a5611
Added test_has_many_through_has_many_with_has_many_through_habtm_source_reflection and make it pass
2010-10-14 12:59:16 +01:00
Jon Leighton
076b75bf98
Add some tests for functionality in JoinAssociation which already exists but was previously untested
2010-10-13 08:24:19 -07:00
Jon Leighton
781ad0f8fe
First bit of support for habtm in through assocs - test_has_many_through_has_many_with_has_and_belongs_to_many_source_reflection now passes
2010-10-13 01:29:09 +01:00
Jon Leighton
c37a5e7acd
Add a commented, failing test for using a habtm in a has many through association. I want to refactor how aliasing works first.
2010-10-12 18:16:31 +01:00
Jon Leighton
dc39aceb94
Adding test_has_many_through_has_one_with_has_many_through_source_reflection and modifying ThroughAssociationScope to make it work correctly.
2010-10-12 17:27:10 +01:00
Jon Leighton
1777600e6e
Support has_one through assocs as the source association
2010-10-12 16:40:24 +01:00
Jon Leighton
ab5a933502
Add support for nested through associations in JoinAssociation. Hence Foo.joins(:bar) will work for through associations. There is some duplicated code now, which will be refactored.
2010-10-09 22:00:33 +01:00
Jon Leighton
f2b41914d6
Refactoring JoinDependency and friends. This improves the code (IMO) including adding some explanatory comments, but more importantly structures it in such a way as to allow a JoinAssociation to produce an arbitrary number of actual joins, which will be necessary for nested has many through support. Also added 3 tests covering functionality which existed but was not previously covered.
2010-10-06 12:06:51 +01:00
Jon Leighton
a34391c3b4
Add support for table aliasing, with a test that needs aliasing in order to work correctly. This test incidentally provides a more complicated test case (4 inner joins, 2 using polymorphism).
2010-10-02 21:45:46 +01:00
Bodaniel Jeanes
b689834bcf
Initial nested_has_many_through support [ #1152 ]
2010-09-26 22:25:25 +10:00