composite_primary_keys 12.0.0 → 12.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +44 -3
  3. data/README.rdoc +3 -2
  4. data/lib/composite_primary_keys.rb +57 -57
  5. data/lib/composite_primary_keys/active_model/attribute_assignment.rb +19 -0
  6. data/lib/composite_primary_keys/arel/sqlserver.rb +1 -3
  7. data/lib/composite_primary_keys/associations/through_association.rb +2 -1
  8. data/lib/composite_primary_keys/attribute_methods.rb +2 -2
  9. data/lib/composite_primary_keys/attribute_methods/primary_key.rb +13 -0
  10. data/lib/composite_primary_keys/base.rb +12 -1
  11. data/lib/composite_primary_keys/composite_arrays.rb +49 -14
  12. data/lib/composite_primary_keys/connection_adapters/abstract/database_statements.rb +8 -3
  13. data/lib/composite_primary_keys/connection_adapters/abstract_adapter.rb +1 -1
  14. data/lib/composite_primary_keys/connection_adapters/mysql/database_statements.rb +24 -0
  15. data/lib/composite_primary_keys/connection_adapters/sqlserver/database_statements.rb +33 -12
  16. data/lib/composite_primary_keys/core.rb +1 -1
  17. data/lib/composite_primary_keys/persistence.rb +2 -2
  18. data/lib/composite_primary_keys/relation.rb +100 -25
  19. data/lib/composite_primary_keys/relation/finder_methods.rb +6 -6
  20. data/lib/composite_primary_keys/relation/predicate_builder/association_query_value.rb +1 -1
  21. data/lib/composite_primary_keys/validations/uniqueness.rb +1 -1
  22. data/lib/composite_primary_keys/version.rb +1 -1
  23. data/test/abstract_unit.rb +3 -5
  24. data/test/fixtures/article.rb +4 -0
  25. data/test/fixtures/articles.yml +4 -3
  26. data/test/fixtures/comment.rb +1 -3
  27. data/test/fixtures/comments.yml +10 -9
  28. data/test/fixtures/db_definitions/db2-create-tables.sql +0 -14
  29. data/test/fixtures/db_definitions/db2-drop-tables.sql +1 -3
  30. data/test/fixtures/db_definitions/mysql.sql +7 -44
  31. data/test/fixtures/db_definitions/oracle.drop.sql +3 -9
  32. data/test/fixtures/db_definitions/oracle.sql +12 -48
  33. data/test/fixtures/db_definitions/postgresql.sql +7 -44
  34. data/test/fixtures/db_definitions/sqlite.sql +6 -42
  35. data/test/fixtures/db_definitions/sqlserver.sql +5 -41
  36. data/test/fixtures/department.rb +8 -3
  37. data/test/fixtures/departments.yml +4 -4
  38. data/test/fixtures/readings.yml +2 -2
  39. data/test/fixtures/restaurants_suburbs.yml +1 -1
  40. data/test/fixtures/streets.yml +2 -2
  41. data/test/fixtures/suburbs.yml +2 -2
  42. data/test/fixtures/user.rb +3 -2
  43. data/test/test_associations.rb +30 -23
  44. data/test/test_composite_arrays.rb +14 -0
  45. data/test/test_create.rb +15 -18
  46. data/test/test_delete.rb +3 -3
  47. data/test/test_exists.rb +5 -5
  48. data/test/test_find.rb +22 -2
  49. data/test/test_habtm.rb +2 -2
  50. data/test/test_ids.rb +5 -6
  51. data/test/test_nested_attributes.rb +0 -57
  52. data/test/test_polymorphic.rb +29 -13
  53. data/test/test_preload.rb +4 -3
  54. data/test/test_serialize.rb +2 -2
  55. data/test/test_update.rb +19 -1
  56. metadata +6 -64
  57. data/test/fixtures/hack.rb +0 -5
  58. data/test/fixtures/hacks.yml +0 -3
  59. data/test/fixtures/pk_called_id.rb +0 -5
  60. data/test/fixtures/pk_called_ids.yml +0 -11
  61. data/test/fixtures/reference_code_using_composite_key_alias.rb +0 -8
  62. data/test/fixtures/reference_code_using_simple_key_alias.rb +0 -8
  63. data/test/fixtures/seat.rb +0 -5
  64. data/test/fixtures/seats.yml +0 -9
  65. data/test/fixtures/topic.rb +0 -6
  66. data/test/fixtures/topic_source.rb +0 -7
  67. data/test/mkmf.log +0 -592
  68. data/test/test_aliases.rb +0 -18
  69. data/test/test_enum.rb +0 -21
  70. data/test/test_suite.rb +0 -35
@@ -1,18 +0,0 @@
1
- require File.expand_path('../abstract_unit', __FILE__)
2
-
3
- class TestAliases < ActiveSupport::TestCase
4
- fixtures :reference_codes
5
-
6
- def test_primary_key_setter_alias_composite_key
7
- reference_code = ReferenceCodeUsingCompositeKeyAlias.find([1, 2])
8
- assert_equal 'MRS', reference_code.code_label
9
- assert_equal 'Mrs', reference_code.abbreviation
10
- end
11
-
12
- def test_primary_key_setter_alias_simple_key
13
- reference_code = ReferenceCodeUsingSimpleKeyAlias.find('MRS')
14
- assert_equal 1, reference_code.reference_type_id
15
- assert_equal 2, reference_code.reference_code
16
- assert_equal 'Mrs', reference_code.abbreviation
17
- end
18
- end
@@ -1,21 +0,0 @@
1
- require File.expand_path('../abstract_unit', __FILE__)
2
-
3
- class TestEnum < ActiveSupport::TestCase
4
- fixtures :comments
5
-
6
- def test_enum_was
7
- comment = Comment.first
8
- assert_nil comment.shown
9
- assert_equal({}, comment.changed_attributes)
10
- comment.shown = :true
11
- assert_equal({ "shown" => nil }, comment.changed_attributes)
12
- assert_equal 'true', comment.shown
13
- assert_nil comment.shown_was
14
-
15
- comment.save
16
-
17
- comment.shown = :false
18
- assert_equal 'false', comment.shown
19
- assert_equal 'true', comment.shown_was
20
- end
21
- end
@@ -1,35 +0,0 @@
1
- %w(
2
- test_aliases
3
- test_associations
4
- test_attribute_methods
5
- test_attributes
6
- test_calculations
7
- test_callbacks
8
- test_composite_arrays
9
- test_counter_cache
10
- test_create
11
- test_delete
12
- test_dumpable
13
- test_dup
14
- test_enum
15
- test_equal
16
- test_exists
17
- test_find
18
- test_habtm
19
- test_ids
20
- test_miscellaneous
21
- test_nested_attributes
22
- test_optimistic
23
- test_pagination
24
- test_polymorphic
25
- test_predicates
26
- test_preload
27
- test_santiago
28
- test_serialize
29
- test_touch
30
- test_tutorial_example
31
- test_update
32
- test_validations
33
- ).each do |test|
34
- require File.expand_path("../#{test}", __FILE__)
35
- end