globe-composite_primary_keys 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +203 -0
- data/Manifest.txt +121 -0
- data/README.txt +41 -0
- data/README_DB2.txt +33 -0
- data/Rakefile +30 -0
- data/composite_primary_keys.gemspec +17 -0
- data/lib/adapter_helper/base.rb +63 -0
- data/lib/adapter_helper/mysql.rb +13 -0
- data/lib/adapter_helper/oracle.rb +12 -0
- data/lib/adapter_helper/oracle_enhanced.rb +12 -0
- data/lib/adapter_helper/postgresql.rb +13 -0
- data/lib/adapter_helper/sqlite3.rb +13 -0
- data/lib/composite_primary_keys.rb +63 -0
- data/lib/composite_primary_keys/association_preload.rb +162 -0
- data/lib/composite_primary_keys/associations.rb +159 -0
- data/lib/composite_primary_keys/attribute_methods.rb +84 -0
- data/lib/composite_primary_keys/base.rb +200 -0
- data/lib/composite_primary_keys/composite_arrays.rb +29 -0
- data/lib/composite_primary_keys/connection_adapters/abstract_adapter.rb +9 -0
- data/lib/composite_primary_keys/connection_adapters/ibm_db_adapter.rb +21 -0
- data/lib/composite_primary_keys/connection_adapters/oracle_adapter.rb +15 -0
- data/lib/composite_primary_keys/connection_adapters/oracle_enhanced_adapter.rb +17 -0
- data/lib/composite_primary_keys/connection_adapters/postgresql_adapter.rb +53 -0
- data/lib/composite_primary_keys/connection_adapters/sqlite3_adapter.rb +15 -0
- data/lib/composite_primary_keys/finder_methods.rb +68 -0
- data/lib/composite_primary_keys/fixtures.rb +8 -0
- data/lib/composite_primary_keys/read.rb +25 -0
- data/lib/composite_primary_keys/reflection.rb +39 -0
- data/lib/composite_primary_keys/relation.rb +31 -0
- data/lib/composite_primary_keys/through_association_scope.rb +212 -0
- data/lib/composite_primary_keys/validations/uniqueness.rb +118 -0
- data/lib/composite_primary_keys/version.rb +9 -0
- data/loader.rb +24 -0
- data/local/database_connections.rb.sample +12 -0
- data/local/paths.rb.sample +2 -0
- data/local/tasks.rb.sample +2 -0
- data/scripts/console.rb +48 -0
- data/scripts/txt2html +67 -0
- data/scripts/txt2js +59 -0
- data/tasks/activerecord_selection.rake +43 -0
- data/tasks/databases.rake +12 -0
- data/tasks/databases/mysql.rake +30 -0
- data/tasks/databases/oracle.rake +25 -0
- data/tasks/databases/postgresql.rake +25 -0
- data/tasks/databases/sqlite3.rake +28 -0
- data/tasks/deployment.rake +22 -0
- data/tasks/local_setup.rake +13 -0
- data/tasks/website.rake +18 -0
- data/test/README_tests.txt +67 -0
- data/test/abstract_unit.rb +103 -0
- data/test/connections/native_ibm_db/connection.rb +23 -0
- data/test/connections/native_mysql/connection.rb +13 -0
- data/test/connections/native_oracle/connection.rb +14 -0
- data/test/connections/native_oracle_enhanced/connection.rb +20 -0
- data/test/connections/native_postgresql/connection.rb +8 -0
- data/test/connections/native_sqlite/connection.rb +9 -0
- data/test/fixtures/article.rb +5 -0
- data/test/fixtures/article_group.rb +4 -0
- data/test/fixtures/article_groups.yml +7 -0
- data/test/fixtures/articles.yml +6 -0
- data/test/fixtures/comment.rb +6 -0
- data/test/fixtures/comments.yml +16 -0
- data/test/fixtures/db_definitions/db2-create-tables.sql +113 -0
- data/test/fixtures/db_definitions/db2-drop-tables.sql +16 -0
- data/test/fixtures/db_definitions/mysql.sql +181 -0
- data/test/fixtures/db_definitions/oracle.drop.sql +39 -0
- data/test/fixtures/db_definitions/oracle.sql +188 -0
- data/test/fixtures/db_definitions/postgresql.sql +206 -0
- data/test/fixtures/db_definitions/sqlite.sql +166 -0
- data/test/fixtures/department.rb +5 -0
- data/test/fixtures/departments.yml +3 -0
- data/test/fixtures/dorm.rb +3 -0
- data/test/fixtures/dorms.yml +2 -0
- data/test/fixtures/employee.rb +4 -0
- data/test/fixtures/employees.yml +9 -0
- data/test/fixtures/group.rb +3 -0
- data/test/fixtures/groups.yml +3 -0
- data/test/fixtures/hack.rb +6 -0
- data/test/fixtures/hacks.yml +2 -0
- data/test/fixtures/kitchen_sink.rb +3 -0
- data/test/fixtures/kitchen_sinks.yml +5 -0
- data/test/fixtures/membership.rb +10 -0
- data/test/fixtures/membership_status.rb +3 -0
- data/test/fixtures/membership_statuses.yml +10 -0
- data/test/fixtures/memberships.yml +6 -0
- data/test/fixtures/product.rb +7 -0
- data/test/fixtures/product_tariff.rb +5 -0
- data/test/fixtures/product_tariffs.yml +12 -0
- data/test/fixtures/products.yml +6 -0
- data/test/fixtures/reading.rb +4 -0
- data/test/fixtures/readings.yml +10 -0
- data/test/fixtures/reference_code.rb +7 -0
- data/test/fixtures/reference_codes.yml +28 -0
- data/test/fixtures/reference_type.rb +7 -0
- data/test/fixtures/reference_types.yml +9 -0
- data/test/fixtures/restaurant.rb +6 -0
- data/test/fixtures/restaurants.yml +5 -0
- data/test/fixtures/restaurants_suburbs.yml +11 -0
- data/test/fixtures/room.rb +10 -0
- data/test/fixtures/room_assignment.rb +4 -0
- data/test/fixtures/room_assignments.yml +4 -0
- data/test/fixtures/room_attribute.rb +3 -0
- data/test/fixtures/room_attribute_assignment.rb +5 -0
- data/test/fixtures/room_attribute_assignments.yml +4 -0
- data/test/fixtures/room_attributes.yml +3 -0
- data/test/fixtures/rooms.yml +3 -0
- data/test/fixtures/seat.rb +5 -0
- data/test/fixtures/seats.yml +4 -0
- data/test/fixtures/street.rb +3 -0
- data/test/fixtures/streets.yml +15 -0
- data/test/fixtures/student.rb +4 -0
- data/test/fixtures/students.yml +2 -0
- data/test/fixtures/suburb.rb +6 -0
- data/test/fixtures/suburbs.yml +9 -0
- data/test/fixtures/tariff.rb +6 -0
- data/test/fixtures/tariffs.yml +13 -0
- data/test/fixtures/user.rb +10 -0
- data/test/fixtures/users.yml +6 -0
- data/test/hash_tricks.rb +34 -0
- data/test/plugins/pagination.rb +405 -0
- data/test/plugins/pagination_helper.rb +135 -0
- data/test/test_associations.rb +178 -0
- data/test/test_attribute_methods.rb +22 -0
- data/test/test_attributes.rb +80 -0
- data/test/test_clone.rb +34 -0
- data/test/test_composite_arrays.rb +32 -0
- data/test/test_create.rb +68 -0
- data/test/test_delete.rb +83 -0
- data/test/test_exists.rb +25 -0
- data/test/test_find.rb +73 -0
- data/test/test_ids.rb +90 -0
- data/test/test_miscellaneous.rb +39 -0
- data/test/test_pagination.rb +38 -0
- data/test/test_polymorphic.rb +32 -0
- data/test/test_santiago.rb +27 -0
- data/test/test_suite.rb +19 -0
- data/test/test_tutorial_example.rb +26 -0
- data/test/test_update.rb +40 -0
- data/test/test_validations.rb +11 -0
- data/website/index.html +195 -0
- data/website/index.txt +159 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +126 -0
- data/website/template.js +3 -0
- data/website/template.rhtml +53 -0
- data/website/version-raw.js +3 -0
- data/website/version-raw.txt +2 -0
- data/website/version.js +4 -0
- data/website/version.txt +3 -0
- metadata +339 -0
data/History.txt
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
== 3.0.1 2010-10-02
|
|
2
|
+
* Integrated the fork of RISCfuture with patches by paranormal and joekhoobyar
|
|
3
|
+
(who integrated some patches by femto113)
|
|
4
|
+
|
|
5
|
+
== 3.0 2010-05-02
|
|
6
|
+
|
|
7
|
+
* Port to Rails 3.0 and Ruby 1.9.2
|
|
8
|
+
|
|
9
|
+
* Backwards compatability issues
|
|
10
|
+
+ You can no longer define a composite primary key with a single field. If you
|
|
11
|
+
try, your model will just default to a standard active record model. Removing
|
|
12
|
+
this corner case simplified the code.
|
|
13
|
+
+ Removed CompositePrimaryKeys::CompositeKeys. This was done so that the #to_s
|
|
14
|
+
method on composite ids, such as [1,2], returns "[1, 2]". This in turns
|
|
15
|
+
reduces the amount of core Rails code that needs to be overridden.
|
|
16
|
+
+ Setting attribute values by string is no longer supported. For example, this
|
|
17
|
+
no longer works:
|
|
18
|
+
my_record[[:main_id, :secondary_id]] = '1,2'
|
|
19
|
+
Instead, do this:
|
|
20
|
+
my_record[[:main_id, :secondary_id]] = [1,2]
|
|
21
|
+
Once again, this was done to reduce the amount of overridden Rails code
|
|
22
|
+
+ At the moment, complex finds with nested arrays do not work. For example
|
|
23
|
+
find([[1,2], [3,4]))
|
|
24
|
+
+ Count methods no longer work. For example, Tariff.count(:include => :product_tariffs)
|
|
25
|
+
in the TestAssociations#test_count test returns an error. This is because Rails 3.0
|
|
26
|
+
uses Arel to perform such calculations, and its not obvious (at least to me) how to
|
|
27
|
+
hook into this new mechanism to support tables with composite keys.
|
|
28
|
+
+ The TestPolymorphic#test_polymorphic_has_many_through is currently failing, but this
|
|
29
|
+
looks like an ActiveRecord 3.0 bug to me.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
== 2.3.5.1 2010-02-13
|
|
33
|
+
|
|
34
|
+
* Resolved "warning: already initialized constant HasManyThroughCantAssociateThroughHasManyReflection" [Titi Ala'ilima]
|
|
35
|
+
|
|
36
|
+
== 2.3.5 2009-12-16
|
|
37
|
+
|
|
38
|
+
* Fixed several bugs in has_one and has_many associations when :primary_key specified [kpumuk]
|
|
39
|
+
|
|
40
|
+
== 2.3.2 2009-07-16
|
|
41
|
+
|
|
42
|
+
* explicitly load associations.rb due to some getting an unitialized constant error
|
|
43
|
+
|
|
44
|
+
== 2.3.2 2009-05-28
|
|
45
|
+
|
|
46
|
+
* get tests working again with AR 2.3.2
|
|
47
|
+
|
|
48
|
+
== 2.2.1 2009-01-21
|
|
49
|
+
|
|
50
|
+
* fix ActiveRecord#exists? to work when passing conditions instead of ids
|
|
51
|
+
|
|
52
|
+
== 2.2.0 2008-10-29
|
|
53
|
+
|
|
54
|
+
* Rails 2.2.0 compatibility
|
|
55
|
+
|
|
56
|
+
== 1.1.0 2008-10-29
|
|
57
|
+
|
|
58
|
+
* fixes to get cpk working for Rails 2.1.2
|
|
59
|
+
|
|
60
|
+
== 1.0.10 2008-10-22
|
|
61
|
+
|
|
62
|
+
* add composite key where clause creator method [timurv]
|
|
63
|
+
|
|
64
|
+
== 1.0.9 2008-09-08
|
|
65
|
+
|
|
66
|
+
* fix postgres tests
|
|
67
|
+
* fix for delete_records when has_many association has composite keys [darxriggs]
|
|
68
|
+
* more consistent table/column name quoting [pbrant]
|
|
69
|
+
|
|
70
|
+
== 1.0.8 2008-08-27
|
|
71
|
+
|
|
72
|
+
* fix has_many :through for non composite models [thx rcarver]
|
|
73
|
+
|
|
74
|
+
== 1.0.7 2008-08-12
|
|
75
|
+
|
|
76
|
+
* fix for the last fix -- when has_many is composite and belongs_to is single
|
|
77
|
+
|
|
78
|
+
== 1.0.6 2008-08-06
|
|
79
|
+
|
|
80
|
+
* fix associations create
|
|
81
|
+
|
|
82
|
+
== 1.0.5 2008-07-25
|
|
83
|
+
|
|
84
|
+
* fix for calculations with a group by clause [thx Sirius Black]
|
|
85
|
+
|
|
86
|
+
== 1.0.4 2008-07-15
|
|
87
|
+
|
|
88
|
+
* support for oracle_enhanced adapter [thx Raimonds Simanovskis]
|
|
89
|
+
|
|
90
|
+
== 1.0.3 2008-07-13
|
|
91
|
+
|
|
92
|
+
* more fixes and tests for has many through [thx Menno van der Sman]
|
|
93
|
+
|
|
94
|
+
== 1.0.2 2008-06-07
|
|
95
|
+
|
|
96
|
+
* fix for has many through when through association has composite keys
|
|
97
|
+
|
|
98
|
+
== 1.0.1 2008-06-06
|
|
99
|
+
|
|
100
|
+
* Oracle fixes
|
|
101
|
+
|
|
102
|
+
== 1.0.0 2008-06-05
|
|
103
|
+
|
|
104
|
+
* Support for Rails 2.1
|
|
105
|
+
|
|
106
|
+
== 0.9.93 2008-06-01
|
|
107
|
+
|
|
108
|
+
* set fixed dependency on activerecord 2.0.2
|
|
109
|
+
|
|
110
|
+
== 0.9.92 2008-02-22
|
|
111
|
+
|
|
112
|
+
* Support for has_and_belongs_to_many
|
|
113
|
+
|
|
114
|
+
== 0.9.91 2008-01-27
|
|
115
|
+
|
|
116
|
+
* Incremented activerecord dependency to 2.0.2 [thx emmanuel.pirsch]
|
|
117
|
+
|
|
118
|
+
== 0.9.90 2008-01-27
|
|
119
|
+
|
|
120
|
+
* Trial release for rails/activerecord 2.0.2 supported
|
|
121
|
+
|
|
122
|
+
== 0.9.1 2007-10-28
|
|
123
|
+
|
|
124
|
+
* Migrations fix - allow :primary_key => [:name] to work [no unit test] [thx Shugo Maeda]
|
|
125
|
+
|
|
126
|
+
== 0.9.0 2007-09-28
|
|
127
|
+
|
|
128
|
+
* Added support for polymorphs [thx nerdrew]
|
|
129
|
+
* init.rb file so gem can be installed as a plugin for Rails [thx nerdrew]
|
|
130
|
+
* Added ibm_db support [thx K Venkatasubramaniyan]
|
|
131
|
+
* Support for cleaning dependents [thx K Venkatasubramaniyan]
|
|
132
|
+
* Rafactored db rake tasks into namespaces
|
|
133
|
+
* Added namespaced tests (e.g. mysql:test for test_mysql)
|
|
134
|
+
|
|
135
|
+
== 0.8.6 / 2007-6-12
|
|
136
|
+
|
|
137
|
+
* 1 emergency fix due to Rails Core change
|
|
138
|
+
* Rails v7004 removed #quote; fixed with connection.quote_column_name [thx nerdrew]
|
|
139
|
+
|
|
140
|
+
== 0.8.5 / 2007-6-5
|
|
141
|
+
|
|
142
|
+
* 1 change due to Rails Core change
|
|
143
|
+
* Can no longer use RAILS_CONNECTION_ADAPTERS from Rails core
|
|
144
|
+
* 7 dev improvement:
|
|
145
|
+
* Changed History.txt syntax to rdoc format
|
|
146
|
+
* Added deploy tasks
|
|
147
|
+
* Removed CHANGELOG + migrated into History.txt
|
|
148
|
+
* Changed PKG_NAME -> GEM_NAME in Rakefile
|
|
149
|
+
* Renamed README -> README.txt for :publish_docs task
|
|
150
|
+
* Added :check_version task
|
|
151
|
+
* VER => VERS in rakefile
|
|
152
|
+
* 1 website improvement:
|
|
153
|
+
* website/index.txt includes link to "8 steps to fix other ppls code"
|
|
154
|
+
|
|
155
|
+
== 0.8.4 / 2007-5-3
|
|
156
|
+
|
|
157
|
+
* 1 bugfix
|
|
158
|
+
* Corrected ids_list => ids in the exception message. That'll teach me for not adding unit tests before fixing bugs.
|
|
159
|
+
|
|
160
|
+
== 0.8.3 / 2007-5-3
|
|
161
|
+
|
|
162
|
+
* 1 bugfix
|
|
163
|
+
* Explicit reference to ::ActiveRecord::RecordNotFound
|
|
164
|
+
* 1 website addition:
|
|
165
|
+
* Added routing help [Pete Sumskas]
|
|
166
|
+
|
|
167
|
+
== 0.8.2 / 2007-4-11
|
|
168
|
+
|
|
169
|
+
* 1 major enhancement:
|
|
170
|
+
* Oracle unit tests!! [Darrin Holst]
|
|
171
|
+
* And they work too
|
|
172
|
+
|
|
173
|
+
== 0.8.1 / 2007-4-10
|
|
174
|
+
|
|
175
|
+
* 1 bug fix:
|
|
176
|
+
* Fixed the distinct(count) for oracle (removed 'as')
|
|
177
|
+
|
|
178
|
+
== 0.8.0 / 2007-4-6
|
|
179
|
+
|
|
180
|
+
* 1 major enhancement:
|
|
181
|
+
* Support for calcualtions on associations
|
|
182
|
+
* 2 new DB supported:
|
|
183
|
+
* Tests run on sqlite
|
|
184
|
+
* Tests run on postgresql
|
|
185
|
+
* History.txt to keep track of changes like these
|
|
186
|
+
* Using Hoe for Rakefile
|
|
187
|
+
* Website generator rake tasks
|
|
188
|
+
|
|
189
|
+
== 0.3.3
|
|
190
|
+
* id=
|
|
191
|
+
* create now work
|
|
192
|
+
|
|
193
|
+
== 0.1.4
|
|
194
|
+
* it was important that #{primary_key} for composites --> 'key1,key2' and not 'key1key2' so created PrimaryKeys class
|
|
195
|
+
|
|
196
|
+
== 0.0.1
|
|
197
|
+
* Initial version
|
|
198
|
+
* set_primary_keys(*keys) is the activation class method to transform an ActiveRecord into a composite primary key AR
|
|
199
|
+
* find(*ids) supports the passing of
|
|
200
|
+
* id sets: Foo.find(2,1),
|
|
201
|
+
* lists of id sets: Foo.find([2,1], [7,3], [8,12]),
|
|
202
|
+
* and even stringified versions of the above:
|
|
203
|
+
* Foo.find '2,1' or Foo.find '2,1;7,3'
|
data/Manifest.txt
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
History.txt
|
|
2
|
+
Manifest.txt
|
|
3
|
+
README.txt
|
|
4
|
+
README_DB2.txt
|
|
5
|
+
Rakefile
|
|
6
|
+
lib/adapter_helper/base.rb
|
|
7
|
+
lib/adapter_helper/mysql.rb
|
|
8
|
+
lib/adapter_helper/oracle.rb
|
|
9
|
+
lib/adapter_helper/postgresql.rb
|
|
10
|
+
lib/adapter_helper/sqlite3.rb
|
|
11
|
+
lib/composite_primary_keys.rb
|
|
12
|
+
lib/composite_primary_keys/association_preload.rb
|
|
13
|
+
lib/composite_primary_keys/associations.rb
|
|
14
|
+
lib/composite_primary_keys/attribute_methods.rb
|
|
15
|
+
lib/composite_primary_keys/base.rb
|
|
16
|
+
lib/composite_primary_keys/composite_arrays.rb
|
|
17
|
+
lib/composite_primary_keys/connection_adapters/ibm_db_adapter.rb
|
|
18
|
+
lib/composite_primary_keys/connection_adapters/oracle_adapter.rb
|
|
19
|
+
lib/composite_primary_keys/connection_adapters/postgresql_adapter.rb
|
|
20
|
+
lib/composite_primary_keys/connection_adapters/sqlite3_adapter.rb
|
|
21
|
+
lib/composite_primary_keys/finder_methods.rb
|
|
22
|
+
lib/composite_primary_keys/fixtures.rb
|
|
23
|
+
lib/composite_primary_keys/read.rb
|
|
24
|
+
lib/composite_primary_keys/reflection.rb
|
|
25
|
+
lib/composite_primary_keys/relation.rb
|
|
26
|
+
lib/composite_primary_keys/through_association_scope.rb
|
|
27
|
+
lib/composite_primary_keys/validations/uniqueness.rb
|
|
28
|
+
lib/composite_primary_keys/version.rb
|
|
29
|
+
loader.rb
|
|
30
|
+
local/database_connections.rb.sample
|
|
31
|
+
local/paths.rb.sample
|
|
32
|
+
local/tasks.rb.sample
|
|
33
|
+
scripts/console.rb
|
|
34
|
+
scripts/txt2html
|
|
35
|
+
scripts/txt2js
|
|
36
|
+
tasks/activerecord_selection.rake
|
|
37
|
+
tasks/databases.rake
|
|
38
|
+
tasks/databases/mysql.rake
|
|
39
|
+
tasks/databases/oracle.rake
|
|
40
|
+
tasks/databases/postgresql.rake
|
|
41
|
+
tasks/databases/sqlite3.rake
|
|
42
|
+
tasks/deployment.rake
|
|
43
|
+
tasks/local_setup.rake
|
|
44
|
+
tasks/website.rake
|
|
45
|
+
test/README_tests.txt
|
|
46
|
+
test/abstract_unit.rb
|
|
47
|
+
test/connections/native_ibm_db/connection.rb
|
|
48
|
+
test/connections/native_mysql/connection.rb
|
|
49
|
+
test/connections/native_oracle/connection.rb
|
|
50
|
+
test/connections/native_postgresql/connection.rb
|
|
51
|
+
test/connections/native_sqlite/connection.rb
|
|
52
|
+
test/fixtures/article.rb
|
|
53
|
+
test/fixtures/articles.yml
|
|
54
|
+
test/fixtures/comment.rb
|
|
55
|
+
test/fixtures/comments.yml
|
|
56
|
+
test/fixtures/db_definitions/db2-create-tables.sql
|
|
57
|
+
test/fixtures/db_definitions/db2-drop-tables.sql
|
|
58
|
+
test/fixtures/db_definitions/mysql.sql
|
|
59
|
+
test/fixtures/db_definitions/oracle.drop.sql
|
|
60
|
+
test/fixtures/db_definitions/oracle.sql
|
|
61
|
+
test/fixtures/db_definitions/postgresql.sql
|
|
62
|
+
test/fixtures/db_definitions/sqlite.sql
|
|
63
|
+
test/fixtures/department.rb
|
|
64
|
+
test/fixtures/departments.yml
|
|
65
|
+
test/fixtures/employee.rb
|
|
66
|
+
test/fixtures/employees.yml
|
|
67
|
+
test/fixtures/group.rb
|
|
68
|
+
test/fixtures/groups.yml
|
|
69
|
+
test/fixtures/hack.rb
|
|
70
|
+
test/fixtures/hacks.yml
|
|
71
|
+
test/fixtures/membership.rb
|
|
72
|
+
test/fixtures/membership_status.rb
|
|
73
|
+
test/fixtures/membership_statuses.yml
|
|
74
|
+
test/fixtures/memberships.yml
|
|
75
|
+
test/fixtures/product.rb
|
|
76
|
+
test/fixtures/product_tariff.rb
|
|
77
|
+
test/fixtures/product_tariffs.yml
|
|
78
|
+
test/fixtures/products.yml
|
|
79
|
+
test/fixtures/reading.rb
|
|
80
|
+
test/fixtures/readings.yml
|
|
81
|
+
test/fixtures/reference_code.rb
|
|
82
|
+
test/fixtures/reference_codes.yml
|
|
83
|
+
test/fixtures/reference_type.rb
|
|
84
|
+
test/fixtures/reference_types.yml
|
|
85
|
+
test/fixtures/street.rb
|
|
86
|
+
test/fixtures/streets.yml
|
|
87
|
+
test/fixtures/suburb.rb
|
|
88
|
+
test/fixtures/suburbs.yml
|
|
89
|
+
test/fixtures/tariff.rb
|
|
90
|
+
test/fixtures/tariffs.yml
|
|
91
|
+
test/fixtures/user.rb
|
|
92
|
+
test/fixtures/users.yml
|
|
93
|
+
test/hash_tricks.rb
|
|
94
|
+
test/plugins/pagination.rb
|
|
95
|
+
test/plugins/pagination_helper.rb
|
|
96
|
+
test/test_associations.rb
|
|
97
|
+
test/test_attribute_methods.rb
|
|
98
|
+
test/test_attributes.rb
|
|
99
|
+
test/test_clone.rb
|
|
100
|
+
test/test_composite_arrays.rb
|
|
101
|
+
test/test_create.rb
|
|
102
|
+
test/test_delete.rb
|
|
103
|
+
test/test_exists.rb
|
|
104
|
+
test/test_find.rb
|
|
105
|
+
test/test_ids.rb
|
|
106
|
+
test/test_miscellaneous.rb
|
|
107
|
+
test/test_pagination.rb
|
|
108
|
+
test/test_polymorphic.rb
|
|
109
|
+
test/test_santiago.rb
|
|
110
|
+
test/test_tutorial_example.rb
|
|
111
|
+
test/test_update.rb
|
|
112
|
+
website/index.html
|
|
113
|
+
website/index.txt
|
|
114
|
+
website/javascripts/rounded_corners_lite.inc.js
|
|
115
|
+
website/stylesheets/screen.css
|
|
116
|
+
website/template.js
|
|
117
|
+
website/template.rhtml
|
|
118
|
+
website/version-raw.js
|
|
119
|
+
website/version-raw.txt
|
|
120
|
+
website/version.js
|
|
121
|
+
website/version.txt
|
data/README.txt
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
== Description
|
|
2
|
+
ActiveRecord (Rails) does not support composite primary keys by default.
|
|
3
|
+
This library extends the activerecord gem to provide CPK support.
|
|
4
|
+
|
|
5
|
+
== Installation
|
|
6
|
+
gem install composite_primary_keys
|
|
7
|
+
|
|
8
|
+
== Synopsis
|
|
9
|
+
require 'composite_primary_keys'
|
|
10
|
+
|
|
11
|
+
class ProductVariation
|
|
12
|
+
set_primary_keys :product_id, :variation_seq
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
record = ProductVariation.find(345, 12)
|
|
16
|
+
|
|
17
|
+
== Notes
|
|
18
|
+
|
|
19
|
+
Also supports composite foreign keys for associations.
|
|
20
|
+
|
|
21
|
+
See http://compositekeys.rubyforge.org for more.
|
|
22
|
+
|
|
23
|
+
== Running Tests
|
|
24
|
+
|
|
25
|
+
See test/README.tests.txt
|
|
26
|
+
|
|
27
|
+
== Url
|
|
28
|
+
|
|
29
|
+
http://compositekeys.rubyforge.org
|
|
30
|
+
|
|
31
|
+
== Questions, Discussion and Contributions
|
|
32
|
+
|
|
33
|
+
http://groups.google.com/compositekeys
|
|
34
|
+
|
|
35
|
+
== Authors
|
|
36
|
+
* Dr Nic Williams (original)
|
|
37
|
+
* Jason Langenauer (base fork)
|
|
38
|
+
* Daniel Berger
|
|
39
|
+
* Charlie O'Keefe
|
|
40
|
+
* Ardith Falkner
|
|
41
|
+
* Ying Hong
|
data/README_DB2.txt
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Composite Primary key support for db2
|
|
2
|
+
|
|
3
|
+
== Driver Support
|
|
4
|
+
|
|
5
|
+
DB2 support requires the IBM_DB driver provided by http://rubyforge.org/projects/rubyibm/
|
|
6
|
+
project. Install using gem install ibm_db. Tested against version 0.60 of the driver.
|
|
7
|
+
This rubyforge project appears to be permenant location for the IBM adapter.
|
|
8
|
+
Older versions of the driver available from IBM Alphaworks will not work.
|
|
9
|
+
|
|
10
|
+
== Driver Bug and workaround provided as part of this plugin
|
|
11
|
+
|
|
12
|
+
Unlike the basic quote routine available for Rails AR, the DB2 adapter's quote
|
|
13
|
+
method doesn't return " column_name = 1 " when string values (integers in string type variable)
|
|
14
|
+
are passed for quoting numeric column. Rather it returns "column_name = '1'.
|
|
15
|
+
DB2 doesn't accept single quoting numeric columns in SQL. Currently, as part of
|
|
16
|
+
this plugin a fix is provided for the DB2 adapter since this plugin does
|
|
17
|
+
pass string values like this. Perhaps a patch should be sent to the DB2 adapter
|
|
18
|
+
project for a permanant fix.
|
|
19
|
+
|
|
20
|
+
== Database Setup
|
|
21
|
+
|
|
22
|
+
Database must be manually created using a separate command. Read the rake task
|
|
23
|
+
for creating tables and change the db name, user and passwords accordingly.
|
|
24
|
+
|
|
25
|
+
== Tested Database Server version
|
|
26
|
+
|
|
27
|
+
This is tested against DB2 v9.1 in Ubuntu Feisty Fawn (7.04)
|
|
28
|
+
|
|
29
|
+
== Tested Database Client version
|
|
30
|
+
|
|
31
|
+
This is tested against DB2 v9.1 in Ubuntu Feisty Fawn (7.04)
|
|
32
|
+
|
|
33
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/testtask'
|
|
3
|
+
|
|
4
|
+
desc "Remove generated files not part of the project"
|
|
5
|
+
task :clean do
|
|
6
|
+
Dir['*.gem'].each{ |f| File.delete(f) }
|
|
7
|
+
Dir['**/*.rbc'].each{ |f| File.delete(f) } # Rubinius
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
namespace :gem do
|
|
11
|
+
desc "Create the gem file for the globe-composite_primary_keys library"
|
|
12
|
+
task :create => [:clean] do
|
|
13
|
+
spec = eval(IO.read('composite_primary_keys.gemspec'))
|
|
14
|
+
Gem::Builder.new(spec).build
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
desc "Install the globe-composite_primary_keys gem."
|
|
18
|
+
task :install => [:create] do
|
|
19
|
+
file = Dir['*.gem'].first
|
|
20
|
+
sh "gem install #{file}"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
Rake::TestTask.new('test') do |t|
|
|
25
|
+
t.libs << 'test'
|
|
26
|
+
t.warning = true
|
|
27
|
+
t.verbose = true
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
task :default => :test
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Gem::Specification.new do |spec|
|
|
2
|
+
spec.name = 'globe-composite_primary_keys'
|
|
3
|
+
spec.version = '3.0.1'
|
|
4
|
+
spec.authors = ['Daniel Berger', 'Ying Hong', "Charlie O'Keefe", 'Ardith Falkner']
|
|
5
|
+
spec.email = 'globedev-auto@globe.gov'
|
|
6
|
+
spec.homepage = 'http://github.com/globegit/composite_primary_keys'
|
|
7
|
+
spec.summary = 'The GLOBE Program fork of the composite_primary_keys library'
|
|
8
|
+
spec.files = Dir['**/*'].reject{ |f| f.include?('.git') }
|
|
9
|
+
spec.test_files = Dir['test/**/*']
|
|
10
|
+
|
|
11
|
+
spec.required_rubygems_version = '>= 1.3.6'
|
|
12
|
+
|
|
13
|
+
spec.add_dependency('activerecord', '~> 3.0.0')
|
|
14
|
+
spec.add_development_dependency('rspec')
|
|
15
|
+
|
|
16
|
+
spec.description = "Adds support for composite primary keys to ActiveRecord."
|
|
17
|
+
end
|