composite_primary_keys 12.0.2 → 12.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.rdoc +880 -841
- data/README.rdoc +180 -179
- data/lib/composite_primary_keys/active_model/attribute_assignment.rb +19 -0
- data/lib/composite_primary_keys/arel/sqlserver.rb +1 -3
- data/lib/composite_primary_keys/associations/association_scope.rb +68 -68
- data/lib/composite_primary_keys/associations/join_dependency.rb +103 -103
- data/lib/composite_primary_keys/associations/through_association.rb +2 -1
- data/lib/composite_primary_keys/attribute_methods/primary_key.rb +13 -0
- data/lib/composite_primary_keys/attribute_methods/read.rb +30 -30
- data/lib/composite_primary_keys/attribute_methods/write.rb +35 -35
- data/lib/composite_primary_keys/attribute_methods.rb +9 -9
- data/lib/composite_primary_keys/base.rb +141 -130
- data/lib/composite_primary_keys/composite_arrays.rb +0 -8
- data/lib/composite_primary_keys/connection_adapters/abstract/database_statements.rb +37 -17
- data/lib/composite_primary_keys/connection_adapters/sqlserver/database_statements.rb +44 -23
- data/lib/composite_primary_keys/core.rb +48 -48
- data/lib/composite_primary_keys/persistence.rb +82 -81
- data/lib/composite_primary_keys/reflection.rb +29 -29
- data/lib/composite_primary_keys/relation/batches.rb +1 -1
- data/lib/composite_primary_keys/relation/calculations.rb +81 -81
- data/lib/composite_primary_keys/relation/finder_methods.rb +235 -235
- data/lib/composite_primary_keys/relation/predicate_builder/association_query_value.rb +20 -20
- data/lib/composite_primary_keys/relation/query_methods.rb +42 -42
- data/lib/composite_primary_keys/relation/where_clause.rb +23 -23
- data/lib/composite_primary_keys/relation.rb +193 -118
- data/lib/composite_primary_keys/version.rb +8 -8
- data/lib/composite_primary_keys.rb +117 -118
- data/test/abstract_unit.rb +114 -113
- data/test/connections/databases.ci.yml +22 -19
- data/test/fixtures/article.rb +4 -0
- data/test/fixtures/articles.yml +4 -3
- data/test/fixtures/comment.rb +1 -3
- data/test/fixtures/comments.yml +10 -9
- data/test/fixtures/db_definitions/db2-create-tables.sql +112 -126
- data/test/fixtures/db_definitions/db2-drop-tables.sql +17 -19
- data/test/fixtures/db_definitions/mysql.sql +180 -217
- data/test/fixtures/db_definitions/oracle.drop.sql +42 -48
- data/test/fixtures/db_definitions/oracle.sql +200 -236
- data/test/fixtures/db_definitions/postgresql.sql +183 -220
- data/test/fixtures/db_definitions/sqlite.sql +170 -206
- data/test/fixtures/db_definitions/sqlserver.sql +176 -212
- data/test/fixtures/department.rb +16 -11
- data/test/fixtures/departments.yml +15 -15
- data/test/fixtures/employees.yml +27 -27
- data/test/fixtures/readings.yml +2 -2
- data/test/fixtures/restaurants_suburbs.yml +11 -11
- data/test/fixtures/streets.yml +16 -16
- data/test/fixtures/suburbs.yml +14 -14
- data/test/fixtures/user.rb +11 -10
- data/test/test_associations.rb +358 -351
- data/test/test_attributes.rb +60 -60
- data/test/test_calculations.rb +42 -42
- data/test/test_create.rb +218 -183
- data/test/test_delete.rb +182 -179
- data/test/test_exists.rb +39 -39
- data/test/test_find.rb +164 -145
- data/test/test_habtm.rb +2 -2
- data/test/test_ids.rb +112 -116
- data/test/test_nested_attributes.rb +67 -124
- data/test/test_polymorphic.rb +29 -13
- data/test/test_preload.rb +4 -3
- data/test/test_serialize.rb +2 -2
- data/test/test_update.rb +96 -78
- metadata +4 -19
- data/test/fixtures/hack.rb +0 -5
- data/test/fixtures/hacks.yml +0 -3
- data/test/fixtures/pk_called_id.rb +0 -5
- data/test/fixtures/pk_called_ids.yml +0 -11
- data/test/fixtures/reference_code_using_composite_key_alias.rb +0 -8
- data/test/fixtures/reference_code_using_simple_key_alias.rb +0 -8
- data/test/fixtures/seat.rb +0 -5
- data/test/fixtures/seats.yml +0 -9
- data/test/fixtures/topic.rb +0 -6
- data/test/fixtures/topic_source.rb +0 -7
- data/test/test_aliases.rb +0 -18
- data/test/test_enum.rb +0 -21
- data/test/test_suite.rb +0 -35
data/test/test_aliases.rb
DELETED
@@ -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
|
data/test/test_enum.rb
DELETED
@@ -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
|
data/test/test_suite.rb
DELETED
@@ -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
|