Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clean up scripts and plugins

  • Loading branch information...
commit 4008fae054d2ae55a68ec0b8cbc4cf58a0d0d808 1 parent a03f508
@jamesu authored
Showing with 8 additions and 11,810 deletions.
  1. +1 −0  Gemfile
  2. +7 −0 Gemfile.lock
  3. +0 −3  script/about
  4. +0 −3  script/breakpointer
  5. +0 −3  script/console
  6. +0 −3  script/dbconsole
  7. +0 −3  script/destroy
  8. +0 −10 script/ferret_server
  9. +0 −3  script/generate
  10. +0 −3  script/performance/benchmarker
  11. +0 −3  script/performance/profiler
  12. +0 −3  script/performance/request
  13. +0 −3  script/plugin
  14. +0 −3  script/process/inspector
  15. +0 −3  script/process/reaper
  16. +0 −3  script/process/spawner
  17. +0 −3  script/runner
  18. +0 −3  script/server
  19. +0 −8 script/spin
  20. +0 −5 vendor/plugins/composite_primary_keys/.gitignore
  21. +0 −152 vendor/plugins/composite_primary_keys/History.txt
  22. +0 −121 vendor/plugins/composite_primary_keys/Manifest.txt
  23. +0 −41 vendor/plugins/composite_primary_keys/README.txt
  24. +0 −33 vendor/plugins/composite_primary_keys/README_DB2.txt
  25. +0 −65 vendor/plugins/composite_primary_keys/Rakefile
  26. +0 −2  vendor/plugins/composite_primary_keys/init.rb
  27. +0 −30 vendor/plugins/composite_primary_keys/install.rb
  28. +0 −63 vendor/plugins/composite_primary_keys/lib/adapter_helper/base.rb
  29. +0 −13 vendor/plugins/composite_primary_keys/lib/adapter_helper/mysql.rb
  30. +0 −12 vendor/plugins/composite_primary_keys/lib/adapter_helper/oracle.rb
  31. +0 −12 vendor/plugins/composite_primary_keys/lib/adapter_helper/oracle_enhanced.rb
  32. +0 −13 vendor/plugins/composite_primary_keys/lib/adapter_helper/postgresql.rb
  33. +0 −13 vendor/plugins/composite_primary_keys/lib/adapter_helper/sqlite3.rb
  34. +0 −55 vendor/plugins/composite_primary_keys/lib/composite_primary_keys.rb
  35. +0 −253 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/association_preload.rb
  36. +0 −428 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/associations.rb
  37. +0 −84 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/attribute_methods.rb
  38. +0 −337 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/base.rb
  39. +0 −69 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/calculations.rb
  40. +0 −30 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/composite_arrays.rb
  41. +0 −9 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/connection_adapters/abstract_adapter.rb
  42. +0 −21 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/connection_adapters/ibm_db_adapter.rb
  43. +0 −15 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/connection_adapters/oracle_adapter.rb
  44. +0 −17 ...or/plugins/composite_primary_keys/lib/composite_primary_keys/connection_adapters/oracle_enhanced_adapter.rb
  45. +0 −53 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/connection_adapters/postgresql_adapter.rb
  46. +0 −15 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/connection_adapters/sqlite3_adapter.rb
  47. +0 −8 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/fixtures.rb
  48. +0 −20 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/migration.rb
  49. +0 −19 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/reflection.rb
  50. +0 −8 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/version.rb
  51. +0 −24 vendor/plugins/composite_primary_keys/loader.rb
  52. +0 −10 vendor/plugins/composite_primary_keys/local/database_connections.rb.sample
  53. +0 −2  vendor/plugins/composite_primary_keys/local/paths.rb.sample
  54. +0 −2  vendor/plugins/composite_primary_keys/local/tasks.rb.sample
  55. +0 −48 vendor/plugins/composite_primary_keys/scripts/console.rb
  56. +0 −67 vendor/plugins/composite_primary_keys/scripts/txt2html
  57. +0 −59 vendor/plugins/composite_primary_keys/scripts/txt2js
  58. +0 −43 vendor/plugins/composite_primary_keys/tasks/activerecord_selection.rake
  59. +0 −12 vendor/plugins/composite_primary_keys/tasks/databases.rake
  60. +0 −30 vendor/plugins/composite_primary_keys/tasks/databases/mysql.rake
  61. +0 −25 vendor/plugins/composite_primary_keys/tasks/databases/oracle.rake
  62. +0 −26 vendor/plugins/composite_primary_keys/tasks/databases/postgresql.rake
  63. +0 −28 vendor/plugins/composite_primary_keys/tasks/databases/sqlite3.rake
  64. +0 −22 vendor/plugins/composite_primary_keys/tasks/deployment.rake
  65. +0 −13 vendor/plugins/composite_primary_keys/tasks/local_setup.rake
  66. +0 −18 vendor/plugins/composite_primary_keys/tasks/website.rake
  67. +0 −67 vendor/plugins/composite_primary_keys/test/README_tests.txt
  68. +0 −94 vendor/plugins/composite_primary_keys/test/abstract_unit.rb
  69. +0 −23 vendor/plugins/composite_primary_keys/test/connections/native_ibm_db/connection.rb
  70. +0 −13 vendor/plugins/composite_primary_keys/test/connections/native_mysql/connection.rb
  71. +0 −14 vendor/plugins/composite_primary_keys/test/connections/native_oracle/connection.rb
  72. +0 −20 vendor/plugins/composite_primary_keys/test/connections/native_oracle_enhanced/connection.rb
  73. +0 −9 vendor/plugins/composite_primary_keys/test/connections/native_postgresql/connection.rb
  74. +0 −9 vendor/plugins/composite_primary_keys/test/connections/native_sqlite/connection.rb
  75. +0 −5 vendor/plugins/composite_primary_keys/test/fixtures/article.rb
  76. +0 −4 vendor/plugins/composite_primary_keys/test/fixtures/article_group.rb
  77. +0 −7 vendor/plugins/composite_primary_keys/test/fixtures/article_groups.yml
  78. +0 −6 vendor/plugins/composite_primary_keys/test/fixtures/articles.yml
  79. +0 −6 vendor/plugins/composite_primary_keys/test/fixtures/comment.rb
  80. +0 −16 vendor/plugins/composite_primary_keys/test/fixtures/comments.yml
  81. +0 −113 vendor/plugins/composite_primary_keys/test/fixtures/db_definitions/db2-create-tables.sql
  82. +0 −16 vendor/plugins/composite_primary_keys/test/fixtures/db_definitions/db2-drop-tables.sql
  83. +0 −174 vendor/plugins/composite_primary_keys/test/fixtures/db_definitions/mysql.sql
  84. +0 −39 vendor/plugins/composite_primary_keys/test/fixtures/db_definitions/oracle.drop.sql
  85. +0 −188 vendor/plugins/composite_primary_keys/test/fixtures/db_definitions/oracle.sql
  86. +0 −199 vendor/plugins/composite_primary_keys/test/fixtures/db_definitions/postgresql.sql
  87. +0 −160 vendor/plugins/composite_primary_keys/test/fixtures/db_definitions/sqlite.sql
  88. +0 −5 vendor/plugins/composite_primary_keys/test/fixtures/department.rb
  89. +0 −3  vendor/plugins/composite_primary_keys/test/fixtures/departments.yml
  90. +0 −3  vendor/plugins/composite_primary_keys/test/fixtures/dorm.rb
  91. +0 −2  vendor/plugins/composite_primary_keys/test/fixtures/dorms.yml
  92. +0 −4 vendor/plugins/composite_primary_keys/test/fixtures/employee.rb
  93. +0 −9 vendor/plugins/composite_primary_keys/test/fixtures/employees.yml
  94. +0 −3  vendor/plugins/composite_primary_keys/test/fixtures/group.rb
  95. +0 −3  vendor/plugins/composite_primary_keys/test/fixtures/groups.yml
  96. +0 −6 vendor/plugins/composite_primary_keys/test/fixtures/hack.rb
  97. +0 −2  vendor/plugins/composite_primary_keys/test/fixtures/hacks.yml
  98. +0 −3  vendor/plugins/composite_primary_keys/test/fixtures/kitchen_sink.rb
  99. +0 −5 vendor/plugins/composite_primary_keys/test/fixtures/kitchen_sinks.yml
  100. +0 −7 vendor/plugins/composite_primary_keys/test/fixtures/membership.rb
  101. +0 −3  vendor/plugins/composite_primary_keys/test/fixtures/membership_status.rb
  102. +0 −10 vendor/plugins/composite_primary_keys/test/fixtures/membership_statuses.yml
  103. +0 −6 vendor/plugins/composite_primary_keys/test/fixtures/memberships.yml
  104. +0 −7 vendor/plugins/composite_primary_keys/test/fixtures/product.rb
  105. +0 −5 vendor/plugins/composite_primary_keys/test/fixtures/product_tariff.rb
  106. +0 −12 vendor/plugins/composite_primary_keys/test/fixtures/product_tariffs.yml
  107. +0 −6 vendor/plugins/composite_primary_keys/test/fixtures/products.yml
  108. +0 −4 vendor/plugins/composite_primary_keys/test/fixtures/reading.rb
  109. +0 −10 vendor/plugins/composite_primary_keys/test/fixtures/readings.yml
  110. +0 −7 vendor/plugins/composite_primary_keys/test/fixtures/reference_code.rb
  111. +0 −28 vendor/plugins/composite_primary_keys/test/fixtures/reference_codes.yml
  112. +0 −7 vendor/plugins/composite_primary_keys/test/fixtures/reference_type.rb
  113. +0 −9 vendor/plugins/composite_primary_keys/test/fixtures/reference_types.yml
  114. +0 −6 vendor/plugins/composite_primary_keys/test/fixtures/restaurant.rb
  115. +0 −5 vendor/plugins/composite_primary_keys/test/fixtures/restaurants.yml
  116. +0 −11 vendor/plugins/composite_primary_keys/test/fixtures/restaurants_suburbs.yml
  117. +0 −10 vendor/plugins/composite_primary_keys/test/fixtures/room.rb
  118. +0 −4 vendor/plugins/composite_primary_keys/test/fixtures/room_assignment.rb
  119. +0 −4 vendor/plugins/composite_primary_keys/test/fixtures/room_assignments.yml
  120. +0 −3  vendor/plugins/composite_primary_keys/test/fixtures/room_attribute.rb
  121. +0 −5 vendor/plugins/composite_primary_keys/test/fixtures/room_attribute_assignment.rb
  122. +0 −4 vendor/plugins/composite_primary_keys/test/fixtures/room_attribute_assignments.yml
  123. +0 −3  vendor/plugins/composite_primary_keys/test/fixtures/room_attributes.yml
  124. +0 −3  vendor/plugins/composite_primary_keys/test/fixtures/rooms.yml
  125. +0 −3  vendor/plugins/composite_primary_keys/test/fixtures/street.rb
  126. +0 −15 vendor/plugins/composite_primary_keys/test/fixtures/streets.yml
  127. +0 −4 vendor/plugins/composite_primary_keys/test/fixtures/student.rb
  128. +0 −2  vendor/plugins/composite_primary_keys/test/fixtures/students.yml
  129. +0 −6 vendor/plugins/composite_primary_keys/test/fixtures/suburb.rb
  130. +0 −9 vendor/plugins/composite_primary_keys/test/fixtures/suburbs.yml
  131. +0 −6 vendor/plugins/composite_primary_keys/test/fixtures/tariff.rb
  132. +0 −13 vendor/plugins/composite_primary_keys/test/fixtures/tariffs.yml
  133. +0 −10 vendor/plugins/composite_primary_keys/test/fixtures/user.rb
  134. +0 −6 vendor/plugins/composite_primary_keys/test/fixtures/users.yml
  135. +0 −34 vendor/plugins/composite_primary_keys/test/hash_tricks.rb
  136. +0 −405 vendor/plugins/composite_primary_keys/test/plugins/pagination.rb
  137. +0 −135 vendor/plugins/composite_primary_keys/test/plugins/pagination_helper.rb
  138. +0 −160 vendor/plugins/composite_primary_keys/test/test_associations.rb
  139. +0 −22 vendor/plugins/composite_primary_keys/test/test_attribute_methods.rb
  140. +0 −84 vendor/plugins/composite_primary_keys/test/test_attributes.rb
  141. +0 −34 vendor/plugins/composite_primary_keys/test/test_clone.rb
  142. +0 −51 vendor/plugins/composite_primary_keys/test/test_composite_arrays.rb
  143. +0 −68 vendor/plugins/composite_primary_keys/test/test_create.rb
  144. +0 −96 vendor/plugins/composite_primary_keys/test/test_delete.rb
  145. +0 −28 vendor/plugins/composite_primary_keys/test/test_dummy.rb
  146. +0 −73 vendor/plugins/composite_primary_keys/test/test_find.rb
  147. +0 −97 vendor/plugins/composite_primary_keys/test/test_ids.rb
  148. +0 −39 vendor/plugins/composite_primary_keys/test/test_miscellaneous.rb
  149. +0 −38 vendor/plugins/composite_primary_keys/test/test_pagination.rb
  150. +0 −31 vendor/plugins/composite_primary_keys/test/test_polymorphic.rb
  151. +0 −27 vendor/plugins/composite_primary_keys/test/test_santiago.rb
  152. +0 −26 vendor/plugins/composite_primary_keys/test/test_tutorial_examle.rb
  153. +0 −40 vendor/plugins/composite_primary_keys/test/test_update.rb
  154. +0 −199 vendor/plugins/composite_primary_keys/website/index.html
  155. +0 −159 vendor/plugins/composite_primary_keys/website/index.txt
  156. +0 −285 vendor/plugins/composite_primary_keys/website/javascripts/rounded_corners_lite.inc.js
  157. +0 −126 vendor/plugins/composite_primary_keys/website/stylesheets/screen.css
  158. +0 −3  vendor/plugins/composite_primary_keys/website/template.js
  159. +0 −53 vendor/plugins/composite_primary_keys/website/template.rhtml
  160. +0 −3  vendor/plugins/composite_primary_keys/website/version-raw.js
  161. +0 −2  vendor/plugins/composite_primary_keys/website/version-raw.txt
  162. +0 −4 vendor/plugins/composite_primary_keys/website/version.js
  163. +0 −3  vendor/plugins/composite_primary_keys/website/version.txt
  164. +0 −35 vendor/plugins/jrails/CHANGELOG
  165. +0 −21 vendor/plugins/jrails/README
  166. +0 −6 vendor/plugins/jrails/init.rb
  167. +0 −9 vendor/plugins/jrails/install.rb
  168. +0 −160 vendor/plugins/jrails/javascripts/jquery-ui.js
  169. +0 −32 vendor/plugins/jrails/javascripts/jquery.js
  170. +0 −3  vendor/plugins/jrails/javascripts/jrails.js
  171. +0 −194 vendor/plugins/jrails/javascripts/sources/jrails.js
  172. +0 −406 vendor/plugins/jrails/lib/jrails.rb
  173. +0 −19 vendor/plugins/jrails/tasks/jrails.rake
  174. +0 −35 vendor/plugins/open_id_authentication/CHANGELOG
  175. +0 −231 vendor/plugins/open_id_authentication/README
  176. +0 −22 vendor/plugins/open_id_authentication/Rakefile
  177. +0 −11 .../open_id_authentication/generators/open_id_authentication_tables/open_id_authentication_tables_generator.rb
  178. +0 −20 vendor/plugins/open_id_authentication/generators/open_id_authentication_tables/templates/migration.rb
  179. +0 −26 vendor/plugins/open_id_authentication/generators/upgrade_open_id_authentication_tables/templates/migration.rb
  180. +0 −11 ...ication/generators/upgrade_open_id_authentication_tables/upgrade_open_id_authentication_tables_generator.rb
  181. +0 −18 vendor/plugins/open_id_authentication/init.rb
  182. +0 −240 vendor/plugins/open_id_authentication/lib/open_id_authentication.rb
  183. +0 −9 vendor/plugins/open_id_authentication/lib/open_id_authentication/association.rb
  184. +0 −55 vendor/plugins/open_id_authentication/lib/open_id_authentication/db_store.rb
  185. +0 −5 vendor/plugins/open_id_authentication/lib/open_id_authentication/nonce.rb
  186. +0 −23 vendor/plugins/open_id_authentication/lib/open_id_authentication/request.rb
  187. +0 −20 vendor/plugins/open_id_authentication/lib/open_id_authentication/timeout_fixes.rb
  188. +0 −30 vendor/plugins/open_id_authentication/tasks/open_id_authentication_tasks.rake
  189. +0 −32 vendor/plugins/open_id_authentication/test/normalize_test.rb
  190. +0 −46 vendor/plugins/open_id_authentication/test/open_id_authentication_test.rb
  191. +0 −14 vendor/plugins/open_id_authentication/test/status_test.rb
  192. +0 −17 vendor/plugins/open_id_authentication/test/test_helper.rb
  193. +0 −5 vendor/plugins/paperclip/.gitignore
  194. +0 −26 vendor/plugins/paperclip/LICENSE
  195. +0 −59 vendor/plugins/paperclip/README.rdoc
  196. +0 −88 vendor/plugins/paperclip/Rakefile
  197. +0 −5 vendor/plugins/paperclip/generators/paperclip/USAGE
  198. +0 −27 vendor/plugins/paperclip/generators/paperclip/paperclip_generator.rb
  199. +0 −19 vendor/plugins/paperclip/generators/paperclip/templates/paperclip_migration.rb.erb
  200. +0 −1  vendor/plugins/paperclip/init.rb
  201. +0 −277 vendor/plugins/paperclip/lib/paperclip.rb
  202. +0 −305 vendor/plugins/paperclip/lib/paperclip/attachment.rb
  203. +0 −114 vendor/plugins/paperclip/lib/paperclip/geometry.rb
  204. +0 −43 vendor/plugins/paperclip/lib/paperclip/iostream.rb
  205. +0 −207 vendor/plugins/paperclip/lib/paperclip/storage.rb
  206. +0 −88 vendor/plugins/paperclip/lib/paperclip/thumbnail.rb
  207. +0 −37 vendor/plugins/paperclip/lib/paperclip/upfile.rb
  208. +0 −32 vendor/plugins/paperclip/shoulda_macros/paperclip.rb
  209. +0 −79 vendor/plugins/paperclip/tasks/paperclip_tasks.rake
  210. +0 −1  vendor/plugins/paperclip/test/.gitignore
  211. +0 −361 vendor/plugins/paperclip/test/attachment_test.rb
  212. +0 −4 vendor/plugins/paperclip/test/database.yml
  213. BIN  vendor/plugins/paperclip/test/fixtures/12k.png
  214. BIN  vendor/plugins/paperclip/test/fixtures/50x50.png
  215. BIN  vendor/plugins/paperclip/test/fixtures/5k.png
  216. +0 −1  vendor/plugins/paperclip/test/fixtures/bad.png
  217. 0  vendor/plugins/paperclip/test/fixtures/text.txt
  218. +0 −164 vendor/plugins/paperclip/test/geometry_test.rb
  219. +0 −57 vendor/plugins/paperclip/test/helper.rb
  220. +0 −393 vendor/plugins/paperclip/test/integration_test.rb
  221. +0 −54 vendor/plugins/paperclip/test/iostream_test.rb
  222. +0 −179 vendor/plugins/paperclip/test/paperclip_test.rb
  223. +0 −167 vendor/plugins/paperclip/test/storage_test.rb
  224. +0 −138 vendor/plugins/paperclip/test/thumbnail_test.rb
  225. +0 −20 vendor/plugins/wiki_engine/MIT-LICENSE
  226. +0 −28 vendor/plugins/wiki_engine/README
  227. +0 −23 vendor/plugins/wiki_engine/Rakefile
  228. +0 −3  vendor/plugins/wiki_engine/app/controllers/wiki_pages_controller.rb
  229. +0 −3  vendor/plugins/wiki_engine/app/helpers/wiki_pages_helper.rb
  230. +0 −3  vendor/plugins/wiki_engine/app/models/wiki_page.rb
  231. +0 −4 vendor/plugins/wiki_engine/app/views/wiki_pages/_content_field.html.erb
  232. +0 −7 vendor/plugins/wiki_engine/app/views/wiki_pages/_form.html.erb
  233. +0 −23 vendor/plugins/wiki_engine/app/views/wiki_pages/_help.html.erb
  234. +0 −18 vendor/plugins/wiki_engine/app/views/wiki_pages/_list.html.erb
  235. +0 −4 vendor/plugins/wiki_engine/app/views/wiki_pages/_main_field.html.erb
  236. +0 −2  vendor/plugins/wiki_engine/app/views/wiki_pages/_operations.html.erb
  237. +0 −4 vendor/plugins/wiki_engine/app/views/wiki_pages/_title_field.html.erb
  238. +0 −11 vendor/plugins/wiki_engine/app/views/wiki_pages/_widget.html.erb
  239. +0 −5 vendor/plugins/wiki_engine/app/views/wiki_pages/_wiki_page.html.erb
  240. +0 −13 vendor/plugins/wiki_engine/app/views/wiki_pages/edit.html.erb
  241. +0 −5 vendor/plugins/wiki_engine/app/views/wiki_pages/index.html.erb
  242. +0 −5 vendor/plugins/wiki_engine/app/views/wiki_pages/list.html.erb
  243. +0 −10 vendor/plugins/wiki_engine/app/views/wiki_pages/new.html.erb
  244. +0 −5 vendor/plugins/wiki_engine/app/views/wiki_pages/not_found.html.erb
  245. +0 −9 vendor/plugins/wiki_engine/app/views/wiki_pages/show.html.erb
  246. +0 −18 vendor/plugins/wiki_engine/generators/wiki_engine/templates/create_wiki_pages.rb
  247. +0 −11 vendor/plugins/wiki_engine/generators/wiki_engine/wiki_engine_generator.rb
  248. +0 −3  vendor/plugins/wiki_engine/init.rb
  249. +0 −6 vendor/plugins/wiki_engine/lib/wiki_engine.rb
  250. +0 −122 vendor/plugins/wiki_engine/lib/wiki_engine/controller.rb
  251. +0 −59 vendor/plugins/wiki_engine/lib/wiki_engine/helper.rb
  252. +0 −24 vendor/plugins/wiki_engine/lib/wiki_engine/model.rb
  253. +0 −5 vendor/plugins/wiki_engine/lib/wiki_engine/user_support.rb
  254. +0 −32 vendor/plugins/wiki_engine/locales/en.yml
  255. +0 −32 vendor/plugins/wiki_engine/locales/es.yml
  256. +0 −4 vendor/plugins/wiki_engine/tasks/acts_as_wiki_tasks.rake
  257. +0 −8 vendor/plugins/wiki_engine/test/acts_as_wiki_test.rb
  258. +0 −13 vendor/plugins/wiki_engine/test/scoped_wiki_page_test.rb
  259. +0 −72 vendor/plugins/wiki_engine/test/test_helper.rb
  260. +0 −32 vendor/plugins/wiki_engine/test/wiki_page_test.rb
  261. +0 −130 vendor/plugins/wiki_engine/test/wiki_pages_controller_test.rb
  262. +0 −37 vendor/plugins/wiki_engine/test/wiki_pages_helper_test.rb
View
1  Gemfile
@@ -6,6 +6,7 @@ gem 'cancan'
gem 'sass-rails', "~> 3.1.0.rc"
gem 'haml'
gem 'uglifier'
+gem 'paperclip'
#group :test, :development do
# gem 'rspec-rails', '~> 2.3.1'
View
7 Gemfile.lock
@@ -43,6 +43,7 @@ GEM
bcrypt-ruby (2.1.4-java)
builder (3.0.0)
cancan (1.6.5)
+ cocaine (0.2.0)
erubis (2.7.0)
execjs (1.2.0)
multi_json (~> 1.0)
@@ -56,6 +57,11 @@ GEM
treetop (~> 1.4.8)
mime-types (1.16)
multi_json (1.0.3)
+ paperclip (2.3.16)
+ activerecord (>= 2.3.0)
+ activesupport (>= 2.3.2)
+ cocaine (>= 0.0.2)
+ mime-types
pg (0.11.0)
polyglot (0.3.1)
rack (1.3.0)
@@ -113,6 +119,7 @@ DEPENDENCIES
cancan
choices!
haml
+ paperclip
pg
rails (= 3.1.0rc4)
sass-rails (~> 3.1.0.rc)
View
3  script/about
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/about'
View
3  script/breakpointer
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/breakpointer'
View
3  script/console
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/console'
View
3  script/dbconsole
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/dbconsole'
View
3  script/destroy
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/destroy'
View
10 script/ferret_server
@@ -1,10 +0,0 @@
-#!/usr/bin/env ruby
-
-begin
- require File.join(File.dirname(__FILE__), '../vendor/plugins/acts_as_ferret/lib/server_manager')
-rescue LoadError
- # try the gem
- require 'rubygems'
- gem 'acts_as_ferret'
- require 'server_manager'
-end
View
3  script/generate
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/generate'
View
3  script/performance/benchmarker
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/performance/benchmarker'
View
3  script/performance/profiler
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/performance/profiler'
View
3  script/performance/request
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/performance/request'
View
3  script/plugin
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/plugin'
View
3  script/process/inspector
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/process/inspector'
View
3  script/process/reaper
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/process/reaper'
View
3  script/process/spawner
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/process/spawner'
View
3  script/runner
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/runner'
View
3  script/server
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/server'
View
8 script/spin
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-/u/apps/railscollab/current/script/process/spawner \
- mongrel \
- --environment=production \
- --instances=1 \
- --address=127.0.0.1 \
- --port=8060
View
5 vendor/plugins/composite_primary_keys/.gitignore
@@ -1,5 +0,0 @@
-log
-tmp
-debug.log
-local/*.rb
-pkg
View
152 vendor/plugins/composite_primary_keys/History.txt
@@ -1,152 +0,0 @@
-== 2.2.0 2008-10-29
-
-* Rails 2.2.0 compatibility
-
-== 1.1.0 2008-10-29
-
-* fixes to get cpk working for Rails 2.1.2
-
-== 1.0.10 2008-10-22
-
-* add composite key where clause creator method [timurv]
-
-== 1.0.9 2008-09-08
-
-* fix postgres tests
-* fix for delete_records when has_many association has composite keys [darxriggs]
-* more consistent table/column name quoting [pbrant]
-
-== 1.0.8 2008-08-27
-
-* fix has_many :through for non composite models [thx rcarver]
-
-== 1.0.7 2008-08-12
-
-* fix for the last fix -- when has_many is composite and belongs_to is single
-
-== 1.0.6 2008-08-06
-
-* fix associations create
-
-== 1.0.5 2008-07-25
-
-* fix for calculations with a group by clause [thx Sirius Black]
-
-== 1.0.4 2008-07-15
-
-* support for oracle_enhanced adapter [thx Raimonds Simanovskis]
-
-== 1.0.3 2008-07-13
-
-* more fixes and tests for has many through [thx Menno van der Sman]
-
-== 1.0.2 2008-06-07
-
-* fix for has many through when through association has composite keys
-
-== 1.0.1 2008-06-06
-
-* Oracle fixes
-
-== 1.0.0 2008-06-05
-
-* Support for Rails 2.1
-
-== 0.9.93 2008-06-01
-
-* set fixed dependency on activerecord 2.0.2
-
-== 0.9.92 2008-02-22
-
-* Support for has_and_belongs_to_many
-
-== 0.9.91 2008-01-27
-
-* Incremented activerecord dependency to 2.0.2 [thx emmanuel.pirsch]
-
-== 0.9.90 2008-01-27
-
-* Trial release for rails/activerecord 2.0.2 supported
-
-== 0.9.1 2007-10-28
-
-* Migrations fix - allow :primary_key => [:name] to work [no unit test] [thx Shugo Maeda]
-
-== 0.9.0 2007-09-28
-
-* Added support for polymorphs [thx nerdrew]
-* init.rb file so gem can be installed as a plugin for Rails [thx nerdrew]
-* Added ibm_db support [thx K Venkatasubramaniyan]
-* Support for cleaning dependents [thx K Venkatasubramaniyan]
-* Rafactored db rake tasks into namespaces
-* Added namespaced tests (e.g. mysql:test for test_mysql)
-
-== 0.8.6 / 2007-6-12
-
-* 1 emergency fix due to Rails Core change
- * Rails v7004 removed #quote; fixed with connection.quote_column_name [thx nerdrew]
-
-== 0.8.5 / 2007-6-5
-
-* 1 change due to Rails Core change
- * Can no longer use RAILS_CONNECTION_ADAPTERS from Rails core
-* 7 dev improvement:
- * Changed History.txt syntax to rdoc format
- * Added deploy tasks
- * Removed CHANGELOG + migrated into History.txt
- * Changed PKG_NAME -> GEM_NAME in Rakefile
- * Renamed README -> README.txt for :publish_docs task
- * Added :check_version task
- * VER => VERS in rakefile
-* 1 website improvement:
- * website/index.txt includes link to "8 steps to fix other ppls code"
-
-== 0.8.4 / 2007-5-3
-
-* 1 bugfix
- * Corrected ids_list => ids in the exception message. That'll teach me for not adding unit tests before fixing bugs.
-
-== 0.8.3 / 2007-5-3
-
-* 1 bugfix
- * Explicit reference to ::ActiveRecord::RecordNotFound
-* 1 website addition:
- * Added routing help [Pete Sumskas]
-
-== 0.8.2 / 2007-4-11
-
-* 1 major enhancement:
- * Oracle unit tests!! [Darrin Holst]
- * And they work too
-
-== 0.8.1 / 2007-4-10
-
-* 1 bug fix:
- * Fixed the distinct(count) for oracle (removed 'as')
-
-== 0.8.0 / 2007-4-6
-
-* 1 major enhancement:
- * Support for calcualtions on associations
-* 2 new DB supported:
- * Tests run on sqlite
- * Tests run on postgresql
-* History.txt to keep track of changes like these
-* Using Hoe for Rakefile
-* Website generator rake tasks
-
-== 0.3.3
-* id=
-* create now work
-
-== 0.1.4
-* it was important that #{primary_key} for composites --> 'key1,key2' and not 'key1key2' so created PrimaryKeys class
-
-== 0.0.1
-* Initial version
-* set_primary_keys(*keys) is the activation class method to transform an ActiveRecord into a composite primary key AR
-* find(*ids) supports the passing of
- * id sets: Foo.find(2,1),
- * lists of id sets: Foo.find([2,1], [7,3], [8,12]),
- * and even stringified versions of the above:
- * Foo.find '2,1' or Foo.find '2,1;7,3'
View
121 vendor/plugins/composite_primary_keys/Manifest.txt
@@ -1,121 +0,0 @@
-History.txt
-Manifest.txt
-README.txt
-README_DB2.txt
-Rakefile
-init.rb
-install.rb
-lib/adapter_helper/base.rb
-lib/adapter_helper/mysql.rb
-lib/adapter_helper/oracle.rb
-lib/adapter_helper/postgresql.rb
-lib/adapter_helper/sqlite3.rb
-lib/composite_primary_keys.rb
-lib/composite_primary_keys/association_preload.rb
-lib/composite_primary_keys/associations.rb
-lib/composite_primary_keys/attribute_methods.rb
-lib/composite_primary_keys/base.rb
-lib/composite_primary_keys/calculations.rb
-lib/composite_primary_keys/composite_arrays.rb
-lib/composite_primary_keys/connection_adapters/ibm_db_adapter.rb
-lib/composite_primary_keys/connection_adapters/oracle_adapter.rb
-lib/composite_primary_keys/connection_adapters/postgresql_adapter.rb
-lib/composite_primary_keys/connection_adapters/sqlite3_adapter.rb
-lib/composite_primary_keys/fixtures.rb
-lib/composite_primary_keys/migration.rb
-lib/composite_primary_keys/reflection.rb
-lib/composite_primary_keys/version.rb
-loader.rb
-local/database_connections.rb.sample
-local/paths.rb.sample
-local/tasks.rb.sample
-scripts/console.rb
-scripts/txt2html
-scripts/txt2js
-tasks/activerecord_selection.rake
-tasks/databases.rake
-tasks/databases/mysql.rake
-tasks/databases/oracle.rake
-tasks/databases/postgresql.rake
-tasks/databases/sqlite3.rake
-tasks/deployment.rake
-tasks/local_setup.rake
-tasks/website.rake
-test/README_tests.txt
-test/abstract_unit.rb
-test/connections/native_ibm_db/connection.rb
-test/connections/native_mysql/connection.rb
-test/connections/native_oracle/connection.rb
-test/connections/native_postgresql/connection.rb
-test/connections/native_sqlite/connection.rb
-test/fixtures/article.rb
-test/fixtures/articles.yml
-test/fixtures/comment.rb
-test/fixtures/comments.yml
-test/fixtures/db_definitions/db2-create-tables.sql
-test/fixtures/db_definitions/db2-drop-tables.sql
-test/fixtures/db_definitions/mysql.sql
-test/fixtures/db_definitions/oracle.drop.sql
-test/fixtures/db_definitions/oracle.sql
-test/fixtures/db_definitions/postgresql.sql
-test/fixtures/db_definitions/sqlite.sql
-test/fixtures/department.rb
-test/fixtures/departments.yml
-test/fixtures/employee.rb
-test/fixtures/employees.yml
-test/fixtures/group.rb
-test/fixtures/groups.yml
-test/fixtures/hack.rb
-test/fixtures/hacks.yml
-test/fixtures/membership.rb
-test/fixtures/membership_status.rb
-test/fixtures/membership_statuses.yml
-test/fixtures/memberships.yml
-test/fixtures/product.rb
-test/fixtures/product_tariff.rb
-test/fixtures/product_tariffs.yml
-test/fixtures/products.yml
-test/fixtures/reading.rb
-test/fixtures/readings.yml
-test/fixtures/reference_code.rb
-test/fixtures/reference_codes.yml
-test/fixtures/reference_type.rb
-test/fixtures/reference_types.yml
-test/fixtures/street.rb
-test/fixtures/streets.yml
-test/fixtures/suburb.rb
-test/fixtures/suburbs.yml
-test/fixtures/tariff.rb
-test/fixtures/tariffs.yml
-test/fixtures/user.rb
-test/fixtures/users.yml
-test/hash_tricks.rb
-test/plugins/pagination.rb
-test/plugins/pagination_helper.rb
-test/test_associations.rb
-test/test_attribute_methods.rb
-test/test_attributes.rb
-test/test_clone.rb
-test/test_composite_arrays.rb
-test/test_create.rb
-test/test_delete.rb
-test/test_dummy.rb
-test/test_find.rb
-test/test_ids.rb
-test/test_miscellaneous.rb
-test/test_pagination.rb
-test/test_polymorphic.rb
-test/test_santiago.rb
-test/test_tutorial_examle.rb
-test/test_update.rb
-tmp/test.db
-website/index.html
-website/index.txt
-website/javascripts/rounded_corners_lite.inc.js
-website/stylesheets/screen.css
-website/template.js
-website/template.rhtml
-website/version-raw.js
-website/version-raw.txt
-website/version.js
-website/version.txt
View
41 vendor/plugins/composite_primary_keys/README.txt
@@ -1,41 +0,0 @@
-= Composite Primary Keys for ActiveRecords
-
-== Summary
-
-ActiveRecords/Rails famously doesn't support composite primary keys.
-This RubyGem extends the activerecord gem to provide CPK support.
-
-== Installation
-
- gem install composite_primary_keys
-
-== Usage
-
- require 'composite_primary_keys'
- class ProductVariation
- set_primary_keys :product_id, :variation_seq
- end
-
- pv = ProductVariation.find(345, 12)
-
-It even supports composite foreign keys for associations.
-
-See http://compositekeys.rubyforge.org for more.
-
-== Running Tests
-
-See test/README.tests.txt
-
-== Url
-
-http://compositekeys.rubyforge.org
-
-== Questions, Discussion and Contributions
-
-http://groups.google.com/compositekeys
-
-== Author
-
-Written by Dr Nic Williams, drnicwilliams@gmail
-Contributions by many!
-
View
33 vendor/plugins/composite_primary_keys/README_DB2.txt
@@ -1,33 +0,0 @@
-Composite Primary key support for db2
-
-== Driver Support ==
-
-DB2 support requires the IBM_DB driver provided by http://rubyforge.org/projects/rubyibm/
-project. Install using gem install ibm_db. Tested against version 0.60 of the driver.
-This rubyforge project appears to be permenant location for the IBM adapter.
-Older versions of the driver available from IBM Alphaworks will not work.
-
-== Driver Bug and workaround provided as part of this plugin ==
-
-Unlike the basic quote routine available for Rails AR, the DB2 adapter's quote
-method doesn't return " column_name = 1 " when string values (integers in string type variable)
-are passed for quoting numeric column. Rather it returns "column_name = '1'.
-DB2 doesn't accept single quoting numeric columns in SQL. Currently, as part of
-this plugin a fix is provided for the DB2 adapter since this plugin does
-pass string values like this. Perhaps a patch should be sent to the DB2 adapter
-project for a permanant fix.
-
-== Database Setup ==
-
-Database must be manually created using a separate command. Read the rake task
-for creating tables and change the db name, user and passwords accordingly.
-
-== Tested Database Server version ==
-
-This is tested against DB2 v9.1 in Ubuntu Feisty Fawn (7.04)
-
-== Tested Database Client version ==
-
-This is tested against DB2 v9.1 in Ubuntu Feisty Fawn (7.04)
-
-
View
65 vendor/plugins/composite_primary_keys/Rakefile
@@ -1,65 +0,0 @@
-require 'rubygems'
-require 'rake'
-require 'rake/clean'
-require 'rake/testtask'
-require 'rake/rdoctask'
-require 'rake/packagetask'
-require 'rake/gempackagetask'
-require 'rake/contrib/rubyforgepublisher'
-require 'fileutils'
-require 'hoe'
-include FileUtils
-require File.join(File.dirname(__FILE__), 'lib', 'composite_primary_keys', 'version')
-
-AUTHOR = "Dr Nic Williams"
-EMAIL = "drnicwilliams@gmail.com"
-DESCRIPTION = "Composite key support for ActiveRecords"
-GEM_NAME = "composite_primary_keys" # what ppl will type to install your gem
-if File.exists?("~/.rubyforge/user-config.yml")
- # TODO this should prob go in a local/ file
- config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
- RUBYFORGE_USERNAME = config["username"]
-end
-RUBYFORGE_PROJECT = "compositekeys"
-HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
-
-REV = nil #File.read(".svn/entries")[/committed-rev="(\d+)"/, 1] rescue nil
-VERS = ENV['VERSION'] || (CompositePrimaryKeys::VERSION::STRING + (REV ? ".#{REV}" : ""))
-CLEAN.include ['**/.*.sw?', '*.gem', '.config','debug.log','*.db','logfile','log/**/*','**/.DS_Store', '.project']
-RDOC_OPTS = ['--quiet', '--title', "newgem documentation",
- "--opname", "index.html",
- "--line-numbers",
- "--main", "README",
- "--inline-source"]
-
-class Hoe
- def extra_deps
- @extra_deps.reject { |x| Array(x).first == 'hoe' }
- end
-end
-
-# Generate all the Rake tasks
-# Run 'rake -T' to see list of generated tasks (from gem root directory)
-hoe = Hoe.new(GEM_NAME, VERS) do |p|
- p.author = AUTHOR
- p.description = DESCRIPTION
- p.email = EMAIL
- p.summary = DESCRIPTION
- p.url = HOMEPATH
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
- p.test_globs = ["test/**/test*.rb"]
- p.clean_globs |= CLEAN #An array of file patterns to delete on clean.
-
- # == Optional
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
- p.extra_deps = [['activerecord', '>= 2.2.0']] #An array of rubygem dependencies.
- #p.spec_extras - A hash of extra values to set in the gemspec.
-end
-
-CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
-PATH = RUBYFORGE_PROJECT
-hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
-
-PROJECT_ROOT = File.expand_path(".")
-
-require 'loader'
View
2  vendor/plugins/composite_primary_keys/init.rb
@@ -1,2 +0,0 @@
-# Include hook code here
-require_dependency 'composite_primary_keys'
View
30 vendor/plugins/composite_primary_keys/install.rb
@@ -1,30 +0,0 @@
-require 'rbconfig'
-require 'find'
-require 'ftools'
-
-include Config
-
-# this was adapted from rdoc's install.rb by ways of Log4r
-
-$sitedir = CONFIG["sitelibdir"]
-unless $sitedir
- version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
- $libdir = File.join(CONFIG["libdir"], "ruby", version)
- $sitedir = $:.find {|x| x =~ /site_ruby/ }
- if !$sitedir
- $sitedir = File.join($libdir, "site_ruby")
- elsif $sitedir !~ Regexp.quote(version)
- $sitedir = File.join($sitedir, version)
- end
-end
-
-# the acual gruntwork
-Dir.chdir("lib")
-
-Find.find("composite_primary_keys", "composite_primary_keys.rb") { |f|
- if f[-3..-1] == ".rb"
- File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
- else
- File::makedirs(File.join($sitedir, *f.split(/\//)))
- end
-}
View
63 vendor/plugins/composite_primary_keys/lib/adapter_helper/base.rb
@@ -1,63 +0,0 @@
-module AdapterHelper
- class Base
- class << self
- attr_accessor :adapter
-
- def load_connection_from_env(adapter)
- self.adapter = adapter
- unless ENV['cpk_adapters']
- puts error_msg_setup_helper
- exit
- end
-
- ActiveRecord::Base.configurations = YAML.load(ENV['cpk_adapters'])
- unless spec = ActiveRecord::Base.configurations[adapter]
- puts error_msg_adapter_helper
- exit
- end
- spec[:adapter] = adapter
- spec
- end
-
- def error_msg_setup_helper
- <<-EOS
-Setup Helper:
- CPK now has a place for your individual testing configuration.
- That is, instead of hardcoding it in the Rakefile and test/connections files,
- there is now a local/database_connections.rb file that is NOT in the
- repository. Your personal DB information (username, password etc) can
- be stored here without making it difficult to submit patches etc.
-
-Installation:
- i) cp locals/database_connections.rb.sample locals/database_connections.rb
- ii) For #{adapter} connection details see "Adapter Setup Helper" below.
- iii) Rerun this task
-
-#{error_msg_adapter_helper}
-
-Current ENV:
- #{ENV.inspect}
- EOS
- end
-
- def error_msg_adapter_helper
- <<-EOS
-Adapter Setup Helper:
- To run #{adapter} tests, you need to setup your #{adapter} connections.
- In your local/database_connections.rb file, within the ENV['cpk_adapter'] hash, add:
- "#{adapter}" => { adapter settings }
-
- That is, it will look like:
- ENV['cpk_adapters'] = {
- "#{adapter}" => {
- :adapter => "#{adapter}",
- :username => "root",
- :password => "root",
- # ...
- }
- }.to_yaml
- EOS
- end
- end
- end
-end
View
13 vendor/plugins/composite_primary_keys/lib/adapter_helper/mysql.rb
@@ -1,13 +0,0 @@
-require File.join(File.dirname(__FILE__), 'base')
-
-module AdapterHelper
- class MySQL < Base
- class << self
- def load_connection_from_env
- spec = super('mysql')
- spec[:database] ||= 'composite_primary_keys_unittest'
- spec
- end
- end
- end
-end
View
12 vendor/plugins/composite_primary_keys/lib/adapter_helper/oracle.rb
@@ -1,12 +0,0 @@
-require File.join(File.dirname(__FILE__), 'base')
-
-module AdapterHelper
- class Oracle < Base
- class << self
- def load_connection_from_env
- spec = super('oracle')
- spec
- end
- end
- end
-end
View
12 vendor/plugins/composite_primary_keys/lib/adapter_helper/oracle_enhanced.rb
@@ -1,12 +0,0 @@
-require File.join(File.dirname(__FILE__), 'base')
-
-module AdapterHelper
- class OracleEnhanced < Base
- class << self
- def load_connection_from_env
- spec = super('oracle_enhanced')
- spec
- end
- end
- end
-end
View
13 vendor/plugins/composite_primary_keys/lib/adapter_helper/postgresql.rb
@@ -1,13 +0,0 @@
-require File.join(File.dirname(__FILE__), 'base')
-
-module AdapterHelper
- class Postgresql < Base
- class << self
- def load_connection_from_env
- spec = super('postgresql')
- spec[:database] ||= 'composite_primary_keys_unittest'
- spec
- end
- end
- end
-end
View
13 vendor/plugins/composite_primary_keys/lib/adapter_helper/sqlite3.rb
@@ -1,13 +0,0 @@
-require File.join(File.dirname(__FILE__), 'base')
-
-module AdapterHelper
- class Sqlite3 < Base
- class << self
- def load_connection_from_env
- spec = super('sqlite3')
- spec[:dbfile] ||= "tmp/test.db"
- spec
- end
- end
- end
-end
View
55 vendor/plugins/composite_primary_keys/lib/composite_primary_keys.rb
@@ -1,55 +0,0 @@
-#--
-# Copyright (c) 2006 Nic Williams
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#++
-
-$:.unshift(File.dirname(__FILE__)) unless
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
-
-unless defined?(ActiveRecord)
- begin
- require 'active_record'
- rescue LoadError
- require 'rubygems'
- require_gem 'activerecord'
- end
-end
-
-require 'composite_primary_keys/fixtures'
-require 'composite_primary_keys/composite_arrays'
-require 'composite_primary_keys/associations'
-require 'composite_primary_keys/association_preload'
-require 'composite_primary_keys/reflection'
-require 'composite_primary_keys/base'
-require 'composite_primary_keys/calculations'
-require 'composite_primary_keys/migration'
-require 'composite_primary_keys/attribute_methods'
-
-ActiveRecord::Base.class_eval do
- include CompositePrimaryKeys::ActiveRecord::Base
-end
-
-Dir[File.dirname(__FILE__) + '/composite_primary_keys/connection_adapters/*.rb'].each do |adapter|
- begin
- require adapter.gsub('.rb','')
- rescue MissingSourceFile
- end
-end
View
253 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/association_preload.rb
@@ -1,253 +0,0 @@
-module CompositePrimaryKeys
- module ActiveRecord
- module AssociationPreload
- def self.append_features(base)
- super
- base.send(:extend, ClassMethods)
- end
-
- # Composite key versions of Association functions
- module ClassMethods
- def preload_has_and_belongs_to_many_association(records, reflection, preload_options={})
- table_name = reflection.klass.quoted_table_name
- id_to_record_map, ids = construct_id_map_for_composite(records)
- records.each {|record| record.send(reflection.name).loaded}
- options = reflection.options
-
- if composite?
- primary_key = reflection.primary_key_name.to_s.split(CompositePrimaryKeys::ID_SEP)
- where = (primary_key * ids.size).in_groups_of(primary_key.size).map do |keys|
- "(" + keys.map{|key| "t0.#{connection.quote_column_name(key)} = ?"}.join(" AND ") + ")"
- end.join(" OR ")
-
- conditions = [where, ids].flatten
- joins = "INNER JOIN #{connection.quote_table_name options[:join_table]} t0 ON #{full_composite_join_clause(reflection, reflection.klass.table_name, reflection.klass.primary_key, 't0', reflection.association_foreign_key)}"
- parent_primary_keys = reflection.primary_key_name.to_s.split(CompositePrimaryKeys::ID_SEP).map{|k| "t0.#{connection.quote_column_name(k)}"}
- parent_record_id = connection.concat(*parent_primary_keys.zip(["','"] * (parent_primary_keys.size - 1)).flatten.compact)
- else
- conditions = ["t0.#{connection.quote_column_name(reflection.primary_key_name)} IN (?)", ids]
- joins = "INNER JOIN #{connection.quote_table_name options[:join_table]} t0 ON #{reflection.klass.quoted_table_name}.#{connection.quote_column_name(reflection.klass.primary_key)} = t0.#{connection.quote_column_name(reflection.association_foreign_key)})"
- parent_record_id = reflection.primary_key_name
- end
-
- conditions.first << append_conditions(reflection, preload_options)
-
- associated_records = reflection.klass.find(:all,
- :conditions => conditions,
- :include => options[:include],
- :joins => joins,
- :select => "#{options[:select] || table_name+'.*'}, #{parent_record_id} as parent_record_id_",
- :order => options[:order])
-
- set_association_collection_records(id_to_record_map, reflection.name, associated_records, 'parent_record_id_')
- end
-
- def preload_has_many_association(records, reflection, preload_options={})
- id_to_record_map, ids = construct_id_map_for_composite(records)
- records.each {|record| record.send(reflection.name).loaded}
- options = reflection.options
-
- if options[:through]
- through_records = preload_through_records(records, reflection, options[:through])
- through_reflection = reflections[options[:through]]
- through_primary_key = through_reflection.primary_key_name
-
- unless through_records.empty?
- source = reflection.source_reflection.name
- #add conditions from reflection!
- through_records.first.class.preload_associations(through_records, source, reflection.options)
- through_records.each do |through_record|
- key = through_primary_key.to_s.split(CompositePrimaryKeys::ID_SEP).map{|k| through_record.send(k)}.join(CompositePrimaryKeys::ID_SEP)
- add_preloaded_records_to_collection(id_to_record_map[key], reflection.name, through_record.send(source))
- end
- end
- else
- associated_records = find_associated_records(ids, reflection, preload_options)
- set_association_collection_records(id_to_record_map, reflection.name, associated_records, reflection.primary_key_name.to_s.split(CompositePrimaryKeys::ID_SEP))
- end
- end
-
- def preload_through_records(records, reflection, through_association)
- through_reflection = reflections[through_association]
- through_primary_key = through_reflection.primary_key_name
-
- if reflection.options[:source_type]
- interface = reflection.source_reflection.options[:foreign_type]
- preload_options = {:conditions => ["#{connection.quote_column_name interface} = ?", reflection.options[:source_type]]}
-
- records.compact!
- records.first.class.preload_associations(records, through_association, preload_options)
-
- # Dont cache the association - we would only be caching a subset
- through_records = []
- records.each do |record|
- proxy = record.send(through_association)
-
- if proxy.respond_to?(:target)
- through_records << proxy.target
- proxy.reset
- else # this is a has_one :through reflection
- through_records << proxy if proxy
- end
- end
- through_records.flatten!
- else
- records.first.class.preload_associations(records, through_association)
- through_records = records.map {|record| record.send(through_association)}.flatten
- end
-
- through_records.compact!
- through_records
- end
-
- def preload_belongs_to_association(records, reflection, preload_options={})
- options = reflection.options
- primary_key_name = reflection.primary_key_name.to_s.split(CompositePrimaryKeys::ID_SEP)
-
- if options[:polymorphic]
- raise AssociationNotSupported, "Polymorphic joins not supported for composite keys"
- else
- # I need to keep the original ids for each record (as opposed to the stringified) so
- # that they get properly converted for each db so the id_map ends up looking like:
- #
- # { '1,2' => {:id => [1,2], :records => [...records...]}}
- id_map = {}
-
- records.each do |record|
- key = primary_key_name.map{|k| record.send(k)}
- key_as_string = key.join(CompositePrimaryKeys::ID_SEP)
-
- if key_as_string
- mapped_records = (id_map[key_as_string] ||= {:id => key, :records => []})
- mapped_records[:records] << record
- end
- end
-
-
- klasses_and_ids = [[reflection.klass.name, id_map]]
- end
-
- klasses_and_ids.each do |klass_and_id|
- klass_name, id_map = *klass_and_id
- klass = klass_name.constantize
- table_name = klass.quoted_table_name
- connection = reflection.active_record.connection
-
- if composite?
- primary_key = klass.primary_key.to_s.split(CompositePrimaryKeys::ID_SEP)
- ids = id_map.keys.uniq.map {|id| id_map[id][:id]}
-
- where = (primary_key * ids.size).in_groups_of(primary_key.size).map do |keys|
- "(" + keys.map{|key| "#{table_name}.#{connection.quote_column_name(key)} = ?"}.join(" AND ") + ")"
- end.join(" OR ")
-
- conditions = [where, ids].flatten
- else
- conditions = ["#{table_name}.#{connection.quote_column_name(primary_key)} IN (?)", id_map.keys.uniq]
- end
-
- conditions.first << append_conditions(reflection, preload_options)
-
- associated_records = klass.find(:all,
- :conditions => conditions,
- :include => options[:include],
- :select => options[:select],
- :joins => options[:joins],
- :order => options[:order])
-
- set_association_single_records(id_map, reflection.name, associated_records, primary_key)
- end
- end
-
- def set_association_collection_records(id_to_record_map, reflection_name, associated_records, key)
- associated_records.each do |associated_record|
- associated_record_key = associated_record[key]
- associated_record_key = associated_record_key.is_a?(Array) ? associated_record_key.join(CompositePrimaryKeys::ID_SEP) : associated_record_key.to_s
- mapped_records = id_to_record_map[associated_record_key]
- add_preloaded_records_to_collection(mapped_records, reflection_name, associated_record)
- end
- end
-
- def set_association_single_records(id_to_record_map, reflection_name, associated_records, key)
- seen_keys = {}
- associated_records.each do |associated_record|
- associated_record_key = associated_record[key]
- associated_record_key = associated_record_key.is_a?(Array) ? associated_record_key.join(CompositePrimaryKeys::ID_SEP) : associated_record_key.to_s
-
- #this is a has_one or belongs_to: there should only be one record.
- #Unfortunately we can't (in portable way) ask the database for 'all records where foo_id in (x,y,z), but please
- # only one row per distinct foo_id' so this where we enforce that
- next if seen_keys[associated_record_key]
- seen_keys[associated_record_key] = true
- mapped_records = id_to_record_map[associated_record_key][:records]
- mapped_records.each do |mapped_record|
- mapped_record.send("set_#{reflection_name}_target", associated_record)
- end
- end
- end
-
- def find_associated_records(ids, reflection, preload_options)
- options = reflection.options
- table_name = reflection.klass.quoted_table_name
-
- if interface = reflection.options[:as]
- raise AssociationNotSupported, "Polymorphic joins not supported for composite keys"
- else
- connection = reflection.active_record.connection
- foreign_key = reflection.primary_key_name
- conditions = ["#{table_name}.#{connection.quote_column_name(foreign_key)} IN (?)", ids]
-
- if composite?
- foreign_keys = foreign_key.to_s.split(CompositePrimaryKeys::ID_SEP)
-
- where = (foreign_keys * ids.size).in_groups_of(foreign_keys.size).map do |keys|
- "(" + keys.map{|key| "#{table_name}.#{connection.quote_column_name(key)} = ?"}.join(" AND ") + ")"
- end.join(" OR ")
-
- conditions = [where, ids].flatten
- end
- end
-
- conditions.first << append_conditions(reflection, preload_options)
-
- reflection.klass.find(:all,
- :select => (preload_options[:select] || options[:select] || "#{table_name}.*"),
- :include => preload_options[:include] || options[:include],
- :conditions => conditions,
- :joins => options[:joins],
- :group => preload_options[:group] || options[:group],
- :order => preload_options[:order] || options[:order])
- end
-
- # Given a collection of ActiveRecord objects, constructs a Hash which maps
- # the objects' IDs to the relevant objects. Returns a 2-tuple
- # <tt>(id_to_record_map, ids)</tt> where +id_to_record_map+ is the Hash,
- # and +ids+ is an Array of record IDs.
- def construct_id_map_for_composite(records)
- id_to_record_map = {}
- ids = []
- records.each do |record|
- primary_key ||= record.class.primary_key
- ids << record.id
- mapped_records = (id_to_record_map[record.id.to_s] ||= [])
- mapped_records << record
- end
- ids.uniq!
- return id_to_record_map, ids
- end
-
- def full_composite_join_clause(reflection, table1, full_keys1, table2, full_keys2)
- connection = reflection.active_record.connection
- full_keys1 = full_keys1.split(CompositePrimaryKeys::ID_SEP) if full_keys1.is_a?(String)
- full_keys2 = full_keys2.split(CompositePrimaryKeys::ID_SEP) if full_keys2.is_a?(String)
- where_clause = [full_keys1, full_keys2].transpose.map do |key_pair|
- quoted1 = connection.quote_table_name(table1)
- quoted2 = connection.quote_table_name(table2)
- "#{quoted1}.#{connection.quote_column_name(key_pair.first)}=#{quoted2}.#{connection.quote_column_name(key_pair.last)}"
- end.join(" AND ")
- "(#{where_clause})"
- end
- end
- end
- end
-end
View
428 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/associations.rb
@@ -1,428 +0,0 @@
-module CompositePrimaryKeys
- module ActiveRecord
- module Associations
- def self.append_features(base)
- super
- base.send(:extend, ClassMethods)
- end
-
- # Composite key versions of Association functions
- module ClassMethods
-
- def construct_counter_sql_with_included_associations(options, join_dependency)
- scope = scope(:find)
- sql = "SELECT COUNT(DISTINCT #{quoted_table_columns(primary_key)})"
-
- # A (slower) workaround if we're using a backend, like sqlite, that doesn't support COUNT DISTINCT.
- if !self.connection.supports_count_distinct?
- sql = "SELECT COUNT(*) FROM (SELECT DISTINCT #{quoted_table_columns(primary_key)}"
- end
-
- sql << " FROM #{quoted_table_name} "
- sql << join_dependency.join_associations.collect{|join| join.association_join }.join
-
- add_joins!(sql, options[:joins], scope)
- add_conditions!(sql, options[:conditions], scope)
- add_limited_ids_condition!(sql, options, join_dependency) if !using_limitable_reflections?(join_dependency.reflections) && ((scope && scope[:limit]) || options[:limit])
-
- add_limit!(sql, options, scope) if using_limitable_reflections?(join_dependency.reflections)
-
- if !self.connection.supports_count_distinct?
- sql << ")"
- end
-
- return sanitize_sql(sql)
- end
-
- def construct_finder_sql_with_included_associations(options, join_dependency)
- scope = scope(:find)
- sql = "SELECT #{column_aliases(join_dependency)} FROM #{(scope && scope[:from]) || options[:from] || quoted_table_name} "
- sql << join_dependency.join_associations.collect{|join| join.association_join }.join
-
- add_joins!(sql, options[:joins], scope)
- add_conditions!(sql, options[:conditions], scope)
- add_limited_ids_condition!(sql, options, join_dependency) if !using_limitable_reflections?(join_dependency.reflections) && options[:limit]
-
- sql << "ORDER BY #{options[:order]} " if options[:order]
-
- add_limit!(sql, options, scope) if using_limitable_reflections?(join_dependency.reflections)
-
- return sanitize_sql(sql)
- end
-
- def table_columns(columns)
- columns.collect {|column| "#{self.quoted_table_name}.#{connection.quote_column_name(column)}"}
- end
-
- def quoted_table_columns(columns)
- table_columns(columns).join(ID_SEP)
- end
-
- end
-
- end
- end
-end
-
-module ActiveRecord::Associations::ClassMethods
- class JoinDependency
- def construct_association(record, join, row)
- case join.reflection.macro
- when :has_many, :has_and_belongs_to_many
- collection = record.send(join.reflection.name)
- collection.loaded
-
- join_aliased_primary_keys = join.active_record.composite? ?
- join.aliased_primary_key : [join.aliased_primary_key]
- return nil if
- record.id.to_s != join.parent.record_id(row).to_s or not
- join_aliased_primary_keys.select {|key| row[key].nil?}.blank?
- association = join.instantiate(row)
- collection.target.push(association) unless collection.target.include?(association)
- when :has_one, :belongs_to
- return if record.id.to_s != join.parent.record_id(row).to_s or
- [*join.aliased_primary_key].any? { |key| row[key].nil? }
- association = join.instantiate(row)
- record.send("set_#{join.reflection.name}_target", association)
- else
- raise ConfigurationError, "unknown macro: #{join.reflection.macro}"
- end
- return association
- end
-
- class JoinBase
- def aliased_primary_key
- active_record.composite? ?
- primary_key.inject([]) {|aliased_keys, key| aliased_keys << "#{ aliased_prefix }_r#{aliased_keys.length}"} :
- "#{ aliased_prefix }_r0"
- end
-
- def record_id(row)
- active_record.composite? ?
- aliased_primary_key.map {|key| row[key]}.to_composite_ids :
- row[aliased_primary_key]
- end
-
- def column_names_with_alias
- unless @column_names_with_alias
- @column_names_with_alias = []
- keys = active_record.composite? ? primary_key.map(&:to_s) : [primary_key]
- (keys + (column_names - keys)).each_with_index do |column_name, i|
- @column_names_with_alias << [column_name, "#{ aliased_prefix }_r#{ i }"]
- end
- end
- return @column_names_with_alias
- end
- end
-
- class JoinAssociation < JoinBase
- alias single_association_join association_join
- def association_join
- reflection.active_record.composite? ? composite_association_join : single_association_join
- end
-
- def composite_association_join
- join = case reflection.macro
- when :has_and_belongs_to_many
- " LEFT OUTER JOIN %s ON %s " % [
- table_alias_for(options[:join_table], aliased_join_table_name),
- composite_join_clause(
- full_keys(aliased_join_table_name, options[:foreign_key] || reflection.active_record.to_s.classify.foreign_key),
- full_keys(reflection.active_record.table_name, reflection.active_record.primary_key)
- )
- ] +
- " LEFT OUTER JOIN %s ON %s " % [
- table_name_and_alias,
- composite_join_clause(
- full_keys(aliased_table_name, klass.primary_key),
- full_keys(aliased_join_table_name, options[:association_foreign_key] || klass.table_name.classify.foreign_key)
- )
- ]
- when :has_many, :has_one
- case
- when reflection.macro == :has_many && reflection.options[:through]
- through_conditions = through_reflection.options[:conditions] ? "AND #{interpolate_sql(sanitize_sql(through_reflection.options[:conditions]))}" : ''
- if through_reflection.options[:as] # has_many :through against a polymorphic join
- raise AssociationNotSupported, "Polymorphic joins not supported for composite keys"
- else
- if source_reflection.macro == :has_many && source_reflection.options[:as]
- raise AssociationNotSupported, "Polymorphic joins not supported for composite keys"
- else
- case source_reflection.macro
- when :belongs_to
- first_key = primary_key
- second_key = options[:foreign_key] || klass.to_s.classify.foreign_key
- when :has_many
- first_key = through_reflection.klass.to_s.classify.foreign_key
- second_key = options[:foreign_key] || primary_key
- end
-
- " LEFT OUTER JOIN %s ON %s " % [
- table_alias_for(through_reflection.klass.table_name, aliased_join_table_name),
- composite_join_clause(
- full_keys(aliased_join_table_name, through_reflection.primary_key_name),
- full_keys(parent.aliased_table_name, parent.primary_key)
- )
- ] +
- " LEFT OUTER JOIN %s ON %s " % [
- table_name_and_alias,
- composite_join_clause(
- full_keys(aliased_table_name, first_key),
- full_keys(aliased_join_table_name, second_key)
- )
- ]
- end
- end
-
- when reflection.macro == :has_many && reflection.options[:as]
- raise AssociationNotSupported, "Polymorphic joins not supported for composite keys"
- when reflection.macro == :has_one && reflection.options[:as]
- raise AssociationNotSupported, "Polymorphic joins not supported for composite keys"
- else
- foreign_key = options[:foreign_key] || reflection.active_record.name.foreign_key
- " LEFT OUTER JOIN %s ON %s " % [
- table_name_and_alias,
- composite_join_clause(
- full_keys(aliased_table_name, foreign_key),
- full_keys(parent.aliased_table_name, parent.primary_key)),
- ]
- end
- when :belongs_to
- " LEFT OUTER JOIN %s ON %s " % [
- table_name_and_alias,
- composite_join_clause(
- full_keys(aliased_table_name, reflection.klass.primary_key),
- full_keys(parent.aliased_table_name, options[:foreign_key] || klass.to_s.foreign_key)),
- ]
- else
- ""
- end || ''
- join << %(AND %s.%s = %s ) % [
- aliased_table_name,
- reflection.active_record.connection.quote_column_name(reflection.active_record.inheritance_column),
- klass.connection.quote(klass.name)] unless klass.descends_from_active_record?
- join << "AND #{interpolate_sql(sanitize_sql(reflection.options[:conditions]))} " if reflection.options[:conditions]
- join
- end
-
- def full_keys(table_name, keys)
- connection = reflection.active_record.connection
- quoted_table_name = connection.quote_table_name(table_name)
- if keys.is_a?(Array)
- keys.collect {|key| "#{quoted_table_name}.#{connection.quote_column_name(key)}"}.join(CompositePrimaryKeys::ID_SEP)
- else
- "#{quoted_table_name}.#{connection.quote_column_name(keys)}"
- end
- end
-
- def composite_join_clause(full_keys1, full_keys2)
- full_keys1 = full_keys1.split(CompositePrimaryKeys::ID_SEP) if full_keys1.is_a?(String)
- full_keys2 = full_keys2.split(CompositePrimaryKeys::ID_SEP) if full_keys2.is_a?(String)
- where_clause = [full_keys1, full_keys2].transpose.map do |key1, key2|
- "#{key1}=#{key2}"
- end.join(" AND ")
- "(#{where_clause})"
- end
- end
- end
-end
-
-module ActiveRecord::Associations
- class AssociationProxy #:nodoc:
-
- def composite_where_clause(full_keys, ids)
- full_keys = full_keys.split(CompositePrimaryKeys::ID_SEP) if full_keys.is_a?(String)
-
- if ids.is_a?(String)
- ids = [[ids]]
- elsif not ids.first.is_a?(Array) # if single comp key passed, turn into an array of 1
- ids = [ids.to_composite_ids]
- end
-
- where_clause = ids.map do |id_set|
- transposed = id_set.size == 1 ? [[full_keys, id_set.first]] : [full_keys, id_set].transpose
- transposed.map do |full_key, id|
- "#{full_key.to_s}=#{@reflection.klass.sanitize(id)}"
- end.join(" AND ")
- end.join(") OR (")
-
- "(#{where_clause})"
- end
-
- def composite_join_clause(full_keys1, full_keys2)
- full_keys1 = full_keys1.split(CompositePrimaryKeys::ID_SEP) if full_keys1.is_a?(String)
- full_keys2 = full_keys2.split(CompositePrimaryKeys::ID_SEP) if full_keys2.is_a?(String)
-
- where_clause = [full_keys1, full_keys2].transpose.map do |key1, key2|
- "#{key1}=#{key2}"
- end.join(" AND ")
-
- "(#{where_clause})"
- end
-
- def full_composite_join_clause(table1, full_keys1, table2, full_keys2)
- connection = @reflection.active_record.connection
- full_keys1 = full_keys1.split(CompositePrimaryKeys::ID_SEP) if full_keys1.is_a?(String)
- full_keys2 = full_keys2.split(CompositePrimaryKeys::ID_SEP) if full_keys2.is_a?(String)
-
- quoted1 = connection.quote_table_name(table1)
- quoted2 = connection.quote_table_name(table2)
-
- where_clause = [full_keys1, full_keys2].transpose.map do |key_pair|
- "#{quoted1}.#{connection.quote_column_name(key_pair.first)}=#{quoted2}.#{connection.quote_column_name(key_pair.last)}"
- end.join(" AND ")
-
- "(#{where_clause})"
- end
-
- def full_keys(table_name, keys)
- connection = @reflection.active_record.connection
- quoted_table_name = connection.quote_table_name(table_name)
- keys = keys.split(CompositePrimaryKeys::ID_SEP) if keys.is_a?(String)
- if keys.is_a?(Array)
- keys.collect {|key| "#{quoted_table_name}.#{connection.quote_column_name(key)}"}.join(CompositePrimaryKeys::ID_SEP)
- else
- "#{quoted_table_name}.#{connection.quote_column_name(keys)}"
- end
- end
-
- def full_columns_equals(table_name, keys, quoted_ids)
- connection = @reflection.active_record.connection
- quoted_table_name = connection.quote_table_name(table_name)
- if keys.is_a?(Symbol) or (keys.is_a?(String) and keys == keys.to_s.split(CompositePrimaryKeys::ID_SEP))
- return "#{quoted_table_name}.#{connection.quote_column_name(keys)} = #{quoted_ids}"
- end
- keys = keys.split(CompositePrimaryKeys::ID_SEP) if keys.is_a?(String)
- quoted_ids = quoted_ids.split(CompositePrimaryKeys::ID_SEP) if quoted_ids.is_a?(String)
- keys_ids = [keys, quoted_ids].transpose
- keys_ids.collect {|key, id| "(#{quoted_table_name}.#{connection.quote_column_name(key)} = #{id})"}.join(' AND ')
- end
-
- def set_belongs_to_association_for(record)
- if @reflection.options[:as]
- record["#{@reflection.options[:as]}_id"] = @owner.id unless @owner.new_record?
- record["#{@reflection.options[:as]}_type"] = @owner.class.base_class.name.to_s
- else
- key_values = @reflection.primary_key_name.to_s.split(CompositePrimaryKeys::ID_SEP).zip([@owner.id].flatten)
- key_values.each{|key, value| record[key] = value} unless @owner.new_record?
- end
- end
- end
-
- class HasAndBelongsToManyAssociation < AssociationCollection #:nodoc:
- def construct_sql
- @reflection.options[:finder_sql] &&= interpolate_sql(@reflection.options[:finder_sql])
-
- if @reflection.options[:finder_sql]
- @finder_sql = @reflection.options[:finder_sql]
- else
- @finder_sql = full_columns_equals(@reflection.options[:join_table], @reflection.primary_key_name, @owner.quoted_id)
- @finder_sql << " AND (#{conditions})" if conditions
- end
-
- @join_sql = "INNER JOIN #{@reflection.active_record.connection.quote_table_name(@reflection.options[:join_table])} ON " +
- full_composite_join_clause(@reflection.klass.table_name, @reflection.klass.primary_key, @reflection.options[:join_table], @reflection.association_foreign_key)
- end
- end
-
- class HasManyAssociation < AssociationCollection #:nodoc:
- def construct_sql
- case
- when @reflection.options[:finder_sql]
- @finder_sql = interpolate_sql(@reflection.options[:finder_sql])
-
- when @reflection.options[:as]
- @finder_sql =
- "#{@reflection.klass.quoted_table_name}.#{@reflection.options[:as]}_id = #{@owner.quoted_id} AND " +
- "#{@reflection.klass.quoted_table_name}.#{@reflection.options[:as]}_type = #{@owner.class.quote_value(@owner.class.base_class.name.to_s)}"
- @finder_sql << " AND (#{conditions})" if conditions
-
- else
- @finder_sql = full_columns_equals(@reflection.klass.table_name, @reflection.primary_key_name, @owner.quoted_id)
- @finder_sql << " AND (#{conditions})" if conditions
- end
-
- if @reflection.options[:counter_sql]
- @counter_sql = interpolate_sql(@reflection.options[:counter_sql])
- elsif @reflection.options[:finder_sql]
- # replace the SELECT clause with COUNT(*), preserving any hints within /* ... */
- @reflection.options[:counter_sql] = @reflection.options[:finder_sql].sub(/SELECT (\/\*.*?\*\/ )?(.*)\bFROM\b/im) { "SELECT #{$1}COUNT(*) FROM" }
- @counter_sql = interpolate_sql(@reflection.options[:counter_sql])
- else
- @counter_sql = @finder_sql
- end
- end
-
- def delete_records(records)
- if @reflection.options[:dependent]
- records.each { |r| r.destroy }
- else
- connection = @reflection.active_record.connection
- field_names = @reflection.primary_key_name.split(',')
- field_names.collect! {|n| connection.quote_column_name(n) + " = NULL"}
- records.each do |r|
- where_clause = nil
-
- if r.quoted_id.to_s.include?(CompositePrimaryKeys::ID_SEP)
- where_clause_terms = [@reflection.klass.primary_key, r.quoted_id].transpose.map do |pair|
- "(#{connection.quote_column_name(pair[0])} = #{pair[1]})"
- end
- where_clause = where_clause_terms.join(" AND ")
- else
- where_clause = connection.quote_column_name(@reflection.klass.primary_key) + ' = ' + r.quoted_id
- end
-
- @reflection.klass.update_all( field_names.join(',') , where_clause)
- end
- end
- end
- end
-
- class HasOneAssociation < BelongsToAssociation #:nodoc:
- def construct_sql
- case
- when @reflection.options[:as]
- @finder_sql =
- "#{@reflection.klass.quoted_table_name}.#{@reflection.options[:as]}_id = #{@owner.quoted_id} AND " +
- "#{@reflection.klass.quoted_table_name}.#{@reflection.options[:as]}_type = #{@owner.class.quote_value(@owner.class.base_class.name.to_s)}"
- else
- @finder_sql = full_columns_equals(@reflection.klass.table_name, @reflection.primary_key_name, @owner.quoted_id)
- end
-
- @finder_sql << " AND (#{conditions})" if conditions
- end
- end
-
- class HasManyThroughAssociation < HasManyAssociation #:nodoc:
- def construct_conditions_with_composite_keys
- if @reflection.through_reflection.options[:as]
- construct_conditions_without_composite_keys
- else
- conditions = full_columns_equals(@reflection.through_reflection.table_name, @reflection.through_reflection.primary_key_name, @owner.quoted_id)
- conditions << " AND (#{sql_conditions})" if sql_conditions
- conditions
- end
- end
- alias_method_chain :construct_conditions, :composite_keys
-
- def construct_joins_with_composite_keys(custom_joins = nil)
- if @reflection.through_reflection.options[:as] || @reflection.source_reflection.options[:as]
- construct_joins_without_composite_keys(custom_joins)
- else
- if @reflection.source_reflection.macro == :belongs_to
- reflection_primary_key = @reflection.klass.primary_key
- source_primary_key = @reflection.source_reflection.primary_key_name
- else
- reflection_primary_key = @reflection.source_reflection.primary_key_name
- source_primary_key = @reflection.klass.primary_key
- end
-
- "INNER JOIN %s ON %s #{@reflection.options[:joins]} #{custom_joins}" % [
- @reflection.through_reflection.quoted_table_name,
- composite_join_clause(full_keys(@reflection.table_name, reflection_primary_key), full_keys(@reflection.through_reflection.table_name, source_primary_key))
- ]
- end
- end
- alias_method_chain :construct_joins, :composite_keys
- end
-end
View
84 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/attribute_methods.rb
@@ -1,84 +0,0 @@
-module CompositePrimaryKeys
- module ActiveRecord
- module AttributeMethods #:nodoc:
- def self.append_features(base)
- super
- base.send(:extend, ClassMethods)
- end
-
- module ClassMethods
- # Define an attribute reader method. Cope with nil column.
- def define_read_method(symbol, attr_name, column)
- cast_code = column.type_cast_code('v') if column
- cast_code = "::#{cast_code}" if cast_code && cast_code.match('ActiveRecord::.*')
- access_code = cast_code ? "(v=@attributes['#{attr_name}']) && #{cast_code}" : "@attributes['#{attr_name}']"
-
- unless self.primary_keys.include?(attr_name.to_sym)
- access_code = access_code.insert(0, "missing_attribute('#{attr_name}', caller) unless @attributes.has_key?('#{attr_name}'); ")
- end
-
- if cache_attribute?(attr_name)
- access_code = "@attributes_cache['#{attr_name}'] ||= (#{access_code})"
- end
-
- evaluate_attribute_method attr_name, "def #{symbol}; #{access_code}; end"
- end
-
- # Evaluate the definition for an attribute related method
- def evaluate_attribute_method(attr_name, method_definition, method_name=attr_name)
- unless primary_keys.include?(method_name.to_sym)
- generated_methods << method_name
- end
-
- begin
- class_eval(method_definition, __FILE__, __LINE__)
- rescue SyntaxError => err
- generated_methods.delete(attr_name)
- if logger
- logger.warn "Exception occurred during reader method compilation."
- logger.warn "Maybe #{attr_name} is not a valid Ruby identifier?"
- logger.warn "#{err.message}"
- end
- end
- end
- end
-
- # Allows access to the object attributes, which are held in the @attributes hash, as though they
- # were first-class methods. So a Person class with a name attribute can use Person#name and
- # Person#name= and never directly use the attributes hash -- except for multiple assigns with
- # ActiveRecord#attributes=. A Milestone class can also ask Milestone#completed? to test that
- # the completed attribute is not nil or 0.
- #
- # It's also possible to instantiate related objects, so a Client class belonging to the clients
- # table with a master_id foreign key can instantiate master through Client#master.
- def method_missing(method_id, *args, &block)
- method_name = method_id.to_s
-
- # If we haven't generated any methods yet, generate them, then
- # see if we've created the method we're looking for.
- if !self.class.generated_methods?
- self.class.define_attribute_methods
-
- if self.class.generated_methods.include?(method_name)
- return self.send(method_id, *args, &block)
- end
- end
-
- if self.class.primary_keys.include?(method_name.to_sym)
- ids[self.class.primary_keys.index(method_name.to_sym)]
- elsif md = self.class.match_attribute_method?(method_name)
- attribute_name, method_type = md.pre_match, md.to_s
- if @attributes.include?(attribute_name)
- __send__("attribute#{method_type}", attribute_name, *args, &block)
- else
- super
- end
- elsif @attributes.include?(method_name)
- read_attribute(method_name)
- else
- super
- end
- end
- end
- end
-end
View
337 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/base.rb
@@ -1,337 +0,0 @@
-module CompositePrimaryKeys
- module ActiveRecord #:nodoc:
- class CompositeKeyError < StandardError #:nodoc:
- end
-
- module Base #:nodoc:
-
- INVALID_FOR_COMPOSITE_KEYS = 'Not appropriate for composite primary keys'
- NOT_IMPLEMENTED_YET = 'Not implemented for composite primary keys yet'
-
- def self.append_features(base)
- super
- base.send(:include, InstanceMethods)
- base.extend(ClassMethods)
- end
-
- module ClassMethods
- def set_primary_keys(*keys)
- keys = keys.first if keys.first.is_a?(Array)
- keys = keys.map { |k| k.to_sym }
- cattr_accessor :primary_keys
- self.primary_keys = keys.to_composite_keys
-
- class_eval <<-EOV
- extend CompositeClassMethods
- include CompositeInstanceMethods
-
- include CompositePrimaryKeys::ActiveRecord::Associations
- include CompositePrimaryKeys::ActiveRecord::AssociationPreload
- include CompositePrimaryKeys::ActiveRecord::Calculations
- include CompositePrimaryKeys::ActiveRecord::AttributeMethods
- EOV
- end
-
- def composite?
- false
- end
- end
-
- module InstanceMethods
- def composite?; self.class.composite?; end
- end
-
- module CompositeInstanceMethods
-
- # A model instance's primary keys is always available as model.ids
- # whether you name it the default 'id' or set it to something else.
- def id
- attr_names = self.class.primary_keys
- CompositeIds.new(attr_names.map { |attr_name| read_attribute(attr_name) })
- end
- alias_method :ids, :id
-
- def to_param
- id.to_s
- end
-
- def id_before_type_cast #:nodoc:
- raise CompositeKeyError, CompositePrimaryKeys::ActiveRecord::Base::NOT_IMPLEMENTED_YET
- end
-
- def quoted_id #:nodoc:
- [self.class.primary_keys, ids].
- transpose.
- map {|attr_name,id| quote_value(id, column_for_attribute(attr_name))}.
- to_composite_ids
- end
-
- # Sets the primary ID.
- def id=(ids)
- ids = ids.split(ID_SEP) if ids.is_a?(String)
- ids.flatten!
- unless ids.is_a?(Array) and ids.length == self.class.primary_keys.length
- raise "#{self.class}.id= requires #{self.class.primary_keys.length} ids"
- end
- [primary_keys, ids].transpose.each {|key, an_id| write_attribute(key , an_id)}
- id
- end
-
- # Returns a clone of the record that hasn't been assigned an id yet and
- # is treated as a new record. Note that this is a "shallow" clone:
- # it copies the object's attributes only, not its associations.
- # The extent of a "deep" clone is application-specific and is therefore
- # left to the application to implement according to its need.
- def clone
- attrs = self.attributes_before_type_cast
- self.class.primary_keys.each {|key| attrs.delete(key.to_s)}
- self.class.new do |record|
- record.send :instance_variable_set, '@attributes', attrs
- end
- end
-
-
- private
- # The xx_without_callbacks methods are overwritten as that is the end of the alias chain
-
- # Creates a new record with values matching those of the instance attributes.
- def create_without_callbacks
- unless self.id
- raise CompositeKeyError, "Composite keys do not generated ids from sequences, you must provide id values"
- end
- attributes_minus_pks = attributes_with_quotes(false)
- quoted_pk_columns = self.class.primary_key.map { |col| connection.quote_column_name(col) }
- cols = quoted_column_names(attributes_minus_pks) << quoted_pk_columns
- vals = attributes_minus_pks.values << quoted_id
- connection.insert(
- "INSERT INTO #{self.class.quoted_table_name} " +
- "(#{cols.join(', ')}) " +
- "VALUES (#{vals.join(', ')})",
- "#{self.class.name} Create",
- self.class.primary_key,
- self.id
- )
- @new_record = false
- return true
- end
-
- # Updates the associated record with values matching those of the instance attributes.
- def update_without_callbacks
- where_clause_terms = [self.class.primary_key, quoted_id].transpose.map do |pair|
- "(#{connection.quote_column_name(pair[0])} = #{pair[1]})"
- end
- where_clause = where_clause_terms.join(" AND ")
- connection.update(
- "UPDATE #{self.class.quoted_table_name} " +
- "SET #{quoted_comma_pair_list(connection, attributes_with_quotes(false))} " +
- "WHERE #{where_clause}",
- "#{self.class.name} Update"
- )
- return true
- end
-
- # Deletes the record in the database and freezes this instance to reflect that no changes should
- # be made (since they can't be persisted).
- def destroy_without_callbacks
- where_clause_terms = [self.class.primary_key, quoted_id].transpose.map do |pair|
- "(#{connection.quote_column_name(pair[0])} = #{pair[1]})"
- end
- where_clause = where_clause_terms.join(" AND ")
- unless new_record?
- connection.delete(
- "DELETE FROM #{self.class.quoted_table_name} " +
- "WHERE #{where_clause}",
- "#{self.class.name} Destroy"
- )
- end
- freeze
- end
- end
-
- module CompositeClassMethods
- def primary_key; primary_keys; end
- def primary_key=(keys); primary_keys = keys; end
-
- def composite?
- true
- end
-
- #ids_to_s([[1,2],[7,3]]) -> "(1,2),(7,3)"
- #ids_to_s([[1,2],[7,3]], ',', ';') -> "1,2;7,3"
- def ids_to_s(many_ids, id_sep = CompositePrimaryKeys::ID_SEP, list_sep = ',', left_bracket = '(', right_bracket = ')')
- many_ids.map {|ids| "#{left_bracket}#{ids}#{right_bracket}"}.join(list_sep)
- end
-
- # Creates WHERE condition from list of composited ids
- # User.update_all({:role => 'admin'}, :conditions => composite_where_clause([[1, 2], [2, 2]])) #=> UPDATE admins SET admin.role='admin' WHERE (admin.type=1 AND admin.type2=2) OR (admin.type=2 AND admin.type2=2)
- # User.find(:all, :conditions => composite_where_clause([[1, 2], [2, 2]])) #=> SELECT * FROM admins WHERE (admin.type=1 AND admin.type2=2) OR (admin.type=2 AND admin.type2=2)
- def composite_where_clause(ids)
- if ids.is_a?(String)
- ids = [[ids]]
- elsif not ids.first.is_a?(Array) # if single comp key passed, turn into an array of 1
- ids = [ids.to_composite_ids]
- end
-
- ids.map do |id_set|
- [primary_keys, id_set].transpose.map do |key, id|
- "#{table_name}.#{key.to_s}=#{sanitize(id)}"
- end.join(" AND ")
- end.join(") OR (")
- end
-
- # Returns true if the given +ids+ represents the primary keys of a record in the database, false otherwise.
- # Example:
- # Person.exists?(5,7)
- def exists?(ids)
- obj = find(ids) rescue false
- !obj.nil? and obj.is_a?(self)
- end
-
- # Deletes the record with the given +ids+ without instantiating an object first, e.g. delete(1,2)
- # If an array of ids is provided (e.g. delete([1,2], [3,4]), all of them
- # are deleted.
- def delete(*ids)
- unless ids.is_a?(Array); raise "*ids must be an Array"; end
- ids = [ids.to_composite_ids] if not ids.first.is_a?(Array)
- where_clause = ids.map do |id_set|
- [primary_keys, id_set].transpose.map do |key, id|
- "#{quoted_table_name}.#{connection.quote_column_name(key.to_s)}=#{sanitize(id)}"
- end.join(" AND ")
- end.join(") OR (")
- delete_all([ "(#{where_clause})" ])
- end
-
- # Destroys the record with the given +ids+ by instantiating the object and calling #destroy (all the callbacks are the triggered).
- # If an array of ids is provided, all of them are destroyed.
- def destroy(*ids)
- unless ids.is_a?(Array); raise "*ids must be an Array"; end
- if ids.first.is_a?(Array)
- ids = ids.map{|compids| compids.to_composite_ids}
- else
- ids = ids.to_composite_ids
- end
- ids.first.is_a?(CompositeIds) ? ids.each { |id_set| find(id_set).destroy } : find(ids).destroy
- end
-
- # Returns an array of column objects for the table associated with this class.
- # Each column that matches to one of the primary keys has its
- # primary attribute set to true
- def columns
- unless @columns
- @columns = connection.columns(table_name, "#{name} Columns")
- @columns.each {|column| column.primary = primary_keys.include?(column.name.to_sym)}
- end
- @columns
- end
-
- ## DEACTIVATED METHODS ##
- public
- # Lazy-set the sequence name to the connection's default. This method
- # is only ever called once since set_sequence_name overrides it.
- def sequence_name #:nodoc:
- raise CompositeKeyError, CompositePrimaryKeys::ActiveRecord::Base::INVALID_FOR_COMPOSITE_KEYS
- end
-
- def reset_sequence_name #:nodoc:
- raise CompositeKeyError, CompositePrimaryKeys::ActiveRecord::Base::INVALID_FOR_COMPOSITE_KEYS
- end
-
- def set_primary_key(value = nil, &block)
- raise CompositeKeyError, CompositePrimaryKeys::ActiveRecord::Base::INVALID_FOR_COMPOSITE_KEYS
- end
-
- private
- def find_one(id, options)
- raise CompositeKeyError, CompositePrimaryKeys::ActiveRecord::Base::INVALID_FOR_COMPOSITE_KEYS
- end
-
- def find_some(ids, options)
- raise CompositeKeyError, CompositePrimaryKeys::ActiveRecord::Base::INVALID_FOR_COMPOSITE_KEYS
- end
-
- def find_from_ids(ids, options)
- ids = ids.first if ids.last == nil
- conditions = " AND (#{sanitize_sql(options[:conditions])})" if options[:conditions]
- # if ids is just a flat list, then its size must = primary_key.length (one id per primary key, in order)
- # if ids is list of lists, then each inner list must follow rule above
- if ids.first.is_a? String
- # find '2,1' -> ids = ['2,1']
- # find '2,1;7,3' -> ids = ['2,1;7,3']
- ids = ids.first.split(ID_SET_SEP).map {|id_set| id_set.split(ID_SEP).to_composite_ids}
- # find '2,1;7,3' -> ids = [['2','1'],['7','3']], inner [] are CompositeIds
- end
- ids = [ids.to_composite_ids] if not ids.first.kind_of?(Array)
- ids.each do |id_set|
- unless id_set.is_a?(Array)
- raise "Ids must be in an Array, instead received: #{id_set.inspect}"
- end
- unless id_set.length == primary_keys.length
- raise "#{id_set.inspect}: Incorrect number of primary keys for #{class_name}: #{primary_keys.inspect}"
- end
- end
-
- # Let keys = [:a, :b]
- # If ids = [[10, 50], [11, 51]], then :conditions =>
- # "(#{quoted_table_name}.a, #{quoted_table_name}.b) IN ((10, 50), (11, 51))"
-
- conditions = ids.map do |id_set|
- [primary_keys, id_set].transpose.map do |key, id|
- col = columns_hash[key.to_s]
- val = quote_value(id, col)
- "#{quoted_table_name}.#{connection.quote_column_name(key.to_s)}=#{val}"
- end.join(" AND ")
- end.join(") OR (")
-
- options.update :conditions => "(#{conditions})"
-
- result = find_every(options)
-
- if result.size == ids.size
- ids.size == 1 ? result[0] : result
- else
- raise ::ActiveRecord::RecordNotFound, "Couldn't find all #{name.pluralize} with IDs (#{ids.inspect})#{conditions}"
- end
- end
- end
- end
- end
-end
-
-
-module ActiveRecord
- ID_SEP = ','
- ID_SET_SEP = ';'
-
- class Base
- # Allows +attr_name+ to be the list of primary_keys, and returns the id
- # of the object
- # e.g. @object[@object.class.primary_key] => [1,1]
- def [](attr_name)
- if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first
- attr_name = attr_name.split(ID_SEP)
- end
- attr_name.is_a?(Array) ?
- attr_name.map {|name| read_attribute(name)} :
- read_attribute(attr_name)
- end
-
- # Updates the attribute identified by <tt>attr_name</tt> with the specified +value+.
- # (Alias for the protected write_attribute method).
- def []=(attr_name, value)
- if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first
- attr_name = attr_name.split(ID_SEP)
- end
-
- if attr_name.is_a? Array
- value = value.split(ID_SEP) if value.is_a? String
- unless value.length == attr_name.length
- raise "Number of attr_names and values do not match"
- end
- #breakpoint
- [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}
- else
- write_attribute(attr_name, value)
- end
- end
- end
-end
View
69 vendor/plugins/composite_primary_keys/lib/composite_primary_keys/calculations.rb
@@ -1,69 +0,0 @@
-module CompositePrimaryKeys
- module ActiveRecord
- module Calculations
- def self.append_features(base)
- super
- base.send(:extend, ClassMethods)
- end
-
- module ClassMethods
- def construct_calculation_sql(operation, column_name, options) #:nodoc:
- operation = operation.to_s.downcase
- options = options.symbolize_keys
-
- scope = scope(:find)
- merged_includes = merge_includes(scope ? scope[