ibm_db 3.0.5-x86-mingw32 → 5.0.5-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (358) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES +4 -0
  3. data/LICENSE +1 -1
  4. data/ParameterizedQueries README +6 -6
  5. data/README +38 -55
  6. data/ext/Makefile +269 -0
  7. data/ext/extconf.rb +34 -3
  8. data/ext/gil_release_version +3 -0
  9. data/ext/ibm_db-i386-mingw32.def +2 -0
  10. data/ext/ibm_db.c +100 -108
  11. data/ext/ibm_db.o +0 -0
  12. data/ext/ibm_db.so +0 -0
  13. data/ext/mkmf.log +110 -0
  14. data/ext/ruby_ibm_db_cli.o +0 -0
  15. data/ext/unicode_support_version +3 -0
  16. data/lib/active_record/connection_adapters/ibm_db_adapter.rb +923 -527
  17. data/lib/active_record/connection_adapters/ibmdb_adapter.rb +4 -1
  18. data/lib/mswin32/ibm_db.rb +7 -39
  19. data/lib/mswin32/rb2x/i386/ibm_db.so +0 -0
  20. data/test/active_record/connection_adapters/fake_adapter.rb +8 -5
  21. data/test/cases/adapter_test.rb +133 -58
  22. data/test/cases/adapters/mysql2/active_schema_test.rb +193 -0
  23. data/test/cases/adapters/mysql2/bind_parameter_test.rb +50 -0
  24. data/test/cases/adapters/mysql2/boolean_test.rb +100 -0
  25. data/test/cases/adapters/mysql2/case_sensitivity_test.rb +63 -0
  26. data/test/cases/adapters/mysql2/charset_collation_test.rb +54 -0
  27. data/test/cases/adapters/mysql2/connection_test.rb +210 -0
  28. data/test/cases/adapters/mysql2/datetime_precision_quoting_test.rb +45 -0
  29. data/test/cases/adapters/mysql2/enum_test.rb +26 -0
  30. data/test/cases/adapters/mysql2/explain_test.rb +21 -0
  31. data/test/cases/adapters/mysql2/json_test.rb +195 -0
  32. data/test/cases/adapters/mysql2/mysql2_adapter_test.rb +83 -0
  33. data/test/cases/adapters/mysql2/reserved_word_test.rb +152 -0
  34. data/test/cases/adapters/mysql2/schema_migrations_test.rb +59 -0
  35. data/test/cases/adapters/mysql2/schema_test.rb +126 -0
  36. data/test/cases/adapters/mysql2/sp_test.rb +36 -0
  37. data/test/cases/adapters/mysql2/sql_types_test.rb +14 -0
  38. data/test/cases/adapters/mysql2/table_options_test.rb +42 -0
  39. data/test/cases/adapters/mysql2/unsigned_type_test.rb +66 -0
  40. data/test/cases/adapters/postgresql/active_schema_test.rb +98 -0
  41. data/test/cases/adapters/postgresql/array_test.rb +339 -0
  42. data/test/cases/adapters/postgresql/bit_string_test.rb +82 -0
  43. data/test/cases/adapters/postgresql/bytea_test.rb +134 -0
  44. data/test/cases/adapters/postgresql/case_insensitive_test.rb +26 -0
  45. data/test/cases/adapters/postgresql/change_schema_test.rb +38 -0
  46. data/test/cases/adapters/postgresql/cidr_test.rb +25 -0
  47. data/test/cases/adapters/postgresql/citext_test.rb +78 -0
  48. data/test/cases/adapters/postgresql/collation_test.rb +53 -0
  49. data/test/cases/adapters/postgresql/composite_test.rb +132 -0
  50. data/test/cases/adapters/postgresql/connection_test.rb +257 -0
  51. data/test/cases/adapters/postgresql/datatype_test.rb +92 -0
  52. data/test/cases/adapters/postgresql/domain_test.rb +47 -0
  53. data/test/cases/adapters/postgresql/enum_test.rb +91 -0
  54. data/test/cases/adapters/postgresql/explain_test.rb +20 -0
  55. data/test/cases/adapters/postgresql/extension_migration_test.rb +63 -0
  56. data/test/cases/adapters/postgresql/full_text_test.rb +44 -0
  57. data/test/cases/adapters/postgresql/geometric_test.rb +378 -0
  58. data/test/cases/adapters/postgresql/hstore_test.rb +382 -0
  59. data/test/cases/adapters/postgresql/infinity_test.rb +69 -0
  60. data/test/cases/adapters/postgresql/integer_test.rb +25 -0
  61. data/test/cases/adapters/postgresql/json_test.rb +237 -0
  62. data/test/cases/adapters/postgresql/ltree_test.rb +53 -0
  63. data/test/cases/adapters/postgresql/money_test.rb +96 -0
  64. data/test/cases/adapters/postgresql/network_test.rb +94 -0
  65. data/test/cases/adapters/postgresql/numbers_test.rb +49 -0
  66. data/test/cases/adapters/postgresql/postgresql_adapter_test.rb +405 -0
  67. data/test/cases/adapters/postgresql/prepared_statements_test.rb +22 -0
  68. data/test/cases/adapters/postgresql/quoting_test.rb +44 -0
  69. data/test/cases/adapters/postgresql/range_test.rb +343 -0
  70. data/test/cases/adapters/postgresql/referential_integrity_test.rb +111 -0
  71. data/test/cases/adapters/postgresql/rename_table_test.rb +34 -0
  72. data/test/cases/adapters/postgresql/schema_authorization_test.rb +119 -0
  73. data/test/cases/adapters/postgresql/schema_test.rb +597 -0
  74. data/test/cases/adapters/postgresql/serial_test.rb +154 -0
  75. data/test/cases/adapters/postgresql/statement_pool_test.rb +41 -0
  76. data/test/cases/adapters/postgresql/timestamp_test.rb +90 -0
  77. data/test/cases/adapters/postgresql/type_lookup_test.rb +33 -0
  78. data/test/cases/adapters/postgresql/utils_test.rb +62 -0
  79. data/test/cases/adapters/postgresql/uuid_test.rb +294 -0
  80. data/test/cases/adapters/postgresql/xml_test.rb +54 -0
  81. data/test/cases/adapters/sqlite3/collation_test.rb +53 -0
  82. data/test/cases/adapters/sqlite3/copy_table_test.rb +98 -0
  83. data/test/cases/adapters/sqlite3/explain_test.rb +21 -0
  84. data/test/cases/adapters/sqlite3/quoting_test.rb +101 -0
  85. data/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +441 -0
  86. data/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb +24 -0
  87. data/test/cases/adapters/sqlite3/statement_pool_test.rb +20 -0
  88. data/test/cases/aggregations_test.rb +11 -1
  89. data/test/cases/ar_schema_test.rb +35 -50
  90. data/test/cases/associations/association_scope_test.rb +1 -6
  91. data/test/cases/associations/belongs_to_associations_test.rb +122 -10
  92. data/test/cases/associations/bidirectional_destroy_dependencies_test.rb +41 -0
  93. data/test/cases/associations/callbacks_test.rb +5 -7
  94. data/test/cases/associations/cascaded_eager_loading_test.rb +1 -1
  95. data/test/cases/associations/eager_load_nested_include_test.rb +1 -3
  96. data/test/cases/associations/eager_test.rb +158 -73
  97. data/test/cases/associations/extension_test.rb +7 -2
  98. data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +64 -32
  99. data/test/cases/associations/has_many_associations_test.rb +362 -43
  100. data/test/cases/associations/has_many_through_associations_test.rb +108 -41
  101. data/test/cases/associations/has_one_associations_test.rb +105 -8
  102. data/test/cases/associations/has_one_through_associations_test.rb +6 -3
  103. data/test/cases/associations/inner_join_association_test.rb +3 -3
  104. data/test/cases/associations/inverse_associations_test.rb +38 -11
  105. data/test/cases/associations/join_model_test.rb +59 -36
  106. data/test/cases/associations/left_outer_join_association_test.rb +88 -0
  107. data/test/cases/associations/nested_through_associations_test.rb +2 -2
  108. data/test/cases/associations/required_test.rb +25 -5
  109. data/test/cases/associations_test.rb +39 -34
  110. data/test/cases/attribute_decorators_test.rb +9 -8
  111. data/test/cases/attribute_methods/read_test.rb +5 -5
  112. data/test/cases/attribute_methods_test.rb +97 -40
  113. data/test/cases/attribute_set_test.rb +64 -4
  114. data/test/cases/attribute_test.rb +84 -18
  115. data/test/cases/attributes_test.rb +151 -34
  116. data/test/cases/autosave_association_test.rb +149 -36
  117. data/test/cases/base_test.rb +290 -241
  118. data/test/cases/batches_test.rb +299 -22
  119. data/test/cases/binary_test.rb +2 -10
  120. data/test/cases/bind_parameter_test.rb +76 -66
  121. data/test/cases/cache_key_test.rb +26 -0
  122. data/test/cases/calculations_test.rb +167 -15
  123. data/test/cases/callbacks_test.rb +161 -68
  124. data/test/cases/coders/json_test.rb +15 -0
  125. data/test/cases/collection_cache_key_test.rb +115 -0
  126. data/test/cases/column_definition_test.rb +26 -57
  127. data/test/cases/comment_test.rb +145 -0
  128. data/test/cases/connection_adapters/adapter_leasing_test.rb +5 -3
  129. data/test/cases/connection_adapters/connection_handler_test.rb +128 -21
  130. data/test/cases/connection_adapters/connection_specification_test.rb +1 -1
  131. data/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb +0 -38
  132. data/test/cases/connection_adapters/mysql_type_lookup_test.rb +5 -1
  133. data/test/cases/connection_adapters/schema_cache_test.rb +8 -3
  134. data/test/cases/connection_adapters/type_lookup_test.rb +15 -7
  135. data/test/cases/connection_management_test.rb +46 -56
  136. data/test/cases/connection_pool_test.rb +195 -20
  137. data/test/cases/connection_specification/resolver_test.rb +15 -0
  138. data/test/cases/counter_cache_test.rb +10 -5
  139. data/test/cases/custom_locking_test.rb +1 -1
  140. data/test/cases/database_statements_test.rb +18 -3
  141. data/test/cases/{invalid_date_test.rb → date_test.rb} +13 -1
  142. data/test/cases/date_time_precision_test.rb +107 -0
  143. data/test/cases/defaults_test.rb +85 -89
  144. data/test/cases/dirty_test.rb +30 -52
  145. data/test/cases/disconnected_test.rb +4 -2
  146. data/test/cases/enum_test.rb +178 -24
  147. data/test/cases/errors_test.rb +16 -0
  148. data/test/cases/explain_test.rb +32 -21
  149. data/test/cases/finder_test.rb +273 -148
  150. data/test/cases/fixture_set/file_test.rb +18 -0
  151. data/test/cases/fixtures_test.rb +112 -32
  152. data/test/cases/forbidden_attributes_protection_test.rb +69 -3
  153. data/test/cases/helper.rb +10 -16
  154. data/test/cases/hot_compatibility_test.rb +89 -1
  155. data/test/cases/inheritance_test.rb +284 -53
  156. data/test/cases/integration_test.rb +23 -7
  157. data/test/cases/invalid_connection_test.rb +4 -2
  158. data/test/cases/invertible_migration_test.rb +124 -32
  159. data/test/cases/json_serialization_test.rb +11 -2
  160. data/test/cases/locking_test.rb +22 -6
  161. data/test/cases/log_subscriber_test.rb +106 -17
  162. data/test/cases/migration/change_schema_test.rb +60 -114
  163. data/test/cases/migration/change_table_test.rb +34 -2
  164. data/test/cases/migration/column_attributes_test.rb +7 -23
  165. data/test/cases/migration/column_positioning_test.rb +8 -8
  166. data/test/cases/migration/columns_test.rb +17 -11
  167. data/test/cases/migration/command_recorder_test.rb +47 -2
  168. data/test/cases/migration/compatibility_test.rb +118 -0
  169. data/test/cases/migration/create_join_table_test.rb +21 -12
  170. data/test/cases/migration/foreign_key_test.rb +52 -18
  171. data/test/cases/migration/index_test.rb +14 -12
  172. data/test/cases/migration/logger_test.rb +1 -1
  173. data/test/cases/migration/pending_migrations_test.rb +0 -1
  174. data/test/cases/migration/references_foreign_key_test.rb +59 -7
  175. data/test/cases/migration/references_index_test.rb +4 -4
  176. data/test/cases/migration/references_statements_test.rb +26 -6
  177. data/test/cases/migration/rename_table_test.rb +25 -25
  178. data/test/cases/migration_test.rb +279 -81
  179. data/test/cases/migrator_test.rb +91 -8
  180. data/test/cases/mixin_test.rb +0 -2
  181. data/test/cases/modules_test.rb +3 -4
  182. data/test/cases/multiparameter_attributes_test.rb +24 -2
  183. data/test/cases/multiple_db_test.rb +11 -4
  184. data/test/cases/nested_attributes_test.rb +61 -33
  185. data/test/cases/persistence_test.rb +102 -10
  186. data/test/cases/pooled_connections_test.rb +3 -3
  187. data/test/cases/primary_keys_test.rb +170 -31
  188. data/test/cases/query_cache_test.rb +216 -96
  189. data/test/cases/quoting_test.rb +65 -19
  190. data/test/cases/readonly_test.rb +2 -1
  191. data/test/cases/reflection_test.rb +68 -22
  192. data/test/cases/relation/delegation_test.rb +3 -8
  193. data/test/cases/relation/merging_test.rb +10 -14
  194. data/test/cases/relation/mutation_test.rb +42 -24
  195. data/test/cases/relation/or_test.rb +92 -0
  196. data/test/cases/relation/predicate_builder_test.rb +4 -2
  197. data/test/cases/relation/record_fetch_warning_test.rb +40 -0
  198. data/test/cases/relation/where_chain_test.rb +23 -99
  199. data/test/cases/relation/where_clause_test.rb +182 -0
  200. data/test/cases/relation/where_test.rb +45 -23
  201. data/test/cases/relation_test.rb +67 -58
  202. data/test/cases/relations_test.rb +249 -38
  203. data/test/cases/result_test.rb +10 -0
  204. data/test/cases/sanitize_test.rb +108 -15
  205. data/test/cases/schema_dumper_test.rb +119 -125
  206. data/test/cases/schema_loading_test.rb +52 -0
  207. data/test/cases/scoping/default_scoping_test.rb +113 -39
  208. data/test/cases/scoping/named_scoping_test.rb +46 -9
  209. data/test/cases/scoping/relation_scoping_test.rb +47 -4
  210. data/test/cases/secure_token_test.rb +32 -0
  211. data/test/cases/serialization_test.rb +1 -1
  212. data/test/cases/serialized_attribute_test.rb +93 -6
  213. data/test/cases/statement_cache_test.rb +38 -0
  214. data/test/cases/store_test.rb +2 -1
  215. data/test/cases/suppressor_test.rb +63 -0
  216. data/test/cases/tasks/database_tasks_test.rb +73 -9
  217. data/test/cases/tasks/mysql_rake_test.rb +139 -118
  218. data/test/cases/tasks/postgresql_rake_test.rb +60 -6
  219. data/test/cases/tasks/sqlite_rake_test.rb +30 -3
  220. data/test/cases/test_case.rb +28 -20
  221. data/test/cases/test_fixtures_test.rb +36 -0
  222. data/test/cases/time_precision_test.rb +103 -0
  223. data/test/cases/timestamp_test.rb +44 -10
  224. data/test/cases/touch_later_test.rb +121 -0
  225. data/test/cases/transaction_callbacks_test.rb +128 -62
  226. data/test/cases/transaction_isolation_test.rb +2 -2
  227. data/test/cases/transactions_test.rb +61 -43
  228. data/test/cases/type/adapter_specific_registry_test.rb +133 -0
  229. data/test/cases/type/date_time_test.rb +14 -0
  230. data/test/cases/type/integer_test.rb +2 -96
  231. data/test/cases/type/string_test.rb +0 -14
  232. data/test/cases/type_test.rb +39 -0
  233. data/test/cases/types_test.rb +1 -118
  234. data/test/cases/unconnected_test.rb +1 -1
  235. data/test/cases/validations/absence_validation_test.rb +73 -0
  236. data/test/cases/validations/association_validation_test.rb +13 -2
  237. data/test/cases/validations/i18n_validation_test.rb +6 -10
  238. data/test/cases/validations/length_validation_test.rb +62 -30
  239. data/test/cases/validations/presence_validation_test.rb +36 -1
  240. data/test/cases/validations/uniqueness_validation_test.rb +128 -37
  241. data/test/cases/validations_repair_helper.rb +2 -6
  242. data/test/cases/validations_test.rb +36 -7
  243. data/test/cases/view_test.rb +102 -5
  244. data/test/cases/yaml_serialization_test.rb +21 -26
  245. data/test/config.example.yml +97 -0
  246. data/test/fixtures/bad_posts.yml +9 -0
  247. data/test/fixtures/books.yml +20 -0
  248. data/test/fixtures/content.yml +3 -0
  249. data/test/fixtures/content_positions.yml +3 -0
  250. data/test/fixtures/dead_parrots.yml +5 -0
  251. data/test/fixtures/live_parrots.yml +4 -0
  252. data/test/fixtures/naked/yml/parrots.yml +2 -0
  253. data/test/fixtures/naked/yml/trees.yml +3 -0
  254. data/test/fixtures/nodes.yml +29 -0
  255. data/test/fixtures/other_comments.yml +6 -0
  256. data/test/fixtures/other_dogs.yml +2 -0
  257. data/test/fixtures/other_posts.yml +7 -0
  258. data/test/fixtures/price_estimates.yml +10 -1
  259. data/test/fixtures/trees.yml +3 -0
  260. data/test/migrations/10_urban/9_add_expressions.rb +1 -1
  261. data/test/migrations/decimal/1_give_me_big_numbers.rb +1 -1
  262. data/test/migrations/magic/1_currencies_have_symbols.rb +1 -1
  263. data/test/migrations/missing/1000_people_have_middle_names.rb +2 -2
  264. data/test/migrations/missing/1_people_have_last_names.rb +2 -2
  265. data/test/migrations/missing/3_we_need_reminders.rb +2 -2
  266. data/test/migrations/missing/4_innocent_jointable.rb +2 -2
  267. data/test/migrations/rename/1_we_need_things.rb +2 -2
  268. data/test/migrations/rename/2_rename_things.rb +2 -2
  269. data/test/migrations/to_copy/1_people_have_hobbies.rb +1 -1
  270. data/test/migrations/to_copy/2_people_have_descriptions.rb +1 -1
  271. data/test/migrations/to_copy2/1_create_articles.rb +1 -1
  272. data/test/migrations/to_copy2/2_create_comments.rb +1 -1
  273. data/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb +1 -1
  274. data/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb +1 -1
  275. data/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb +1 -1
  276. data/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb +1 -1
  277. data/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb +1 -1
  278. data/test/migrations/valid/1_valid_people_have_last_names.rb +1 -1
  279. data/test/migrations/valid/2_we_need_reminders.rb +2 -2
  280. data/test/migrations/valid/3_innocent_jointable.rb +2 -2
  281. data/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb +1 -1
  282. data/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb +2 -2
  283. data/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb +2 -2
  284. data/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb +1 -1
  285. data/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb +1 -1
  286. data/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb +1 -1
  287. data/test/migrations/version_check/20131219224947_migration_version_check.rb +1 -1
  288. data/test/models/admin/randomly_named_c1.rb +6 -2
  289. data/test/models/aircraft.rb +1 -0
  290. data/test/models/author.rb +4 -7
  291. data/test/models/bird.rb +1 -1
  292. data/test/models/book.rb +5 -0
  293. data/test/models/bulb.rb +2 -1
  294. data/test/models/car.rb +3 -0
  295. data/test/models/cat.rb +10 -0
  296. data/test/models/chef.rb +1 -0
  297. data/test/models/club.rb +2 -0
  298. data/test/models/comment.rb +17 -5
  299. data/test/models/company.rb +4 -2
  300. data/test/models/company_in_module.rb +1 -1
  301. data/test/models/contact.rb +1 -1
  302. data/test/models/content.rb +40 -0
  303. data/test/models/customer.rb +8 -2
  304. data/test/models/developer.rb +19 -0
  305. data/test/models/face.rb +1 -1
  306. data/test/models/guitar.rb +4 -0
  307. data/test/models/hotel.rb +2 -0
  308. data/test/models/member.rb +1 -0
  309. data/test/models/member_detail.rb +4 -3
  310. data/test/models/mentor.rb +3 -0
  311. data/test/models/mocktail_designer.rb +2 -0
  312. data/test/models/node.rb +5 -0
  313. data/test/models/non_primary_key.rb +2 -0
  314. data/test/models/notification.rb +3 -0
  315. data/test/models/other_dog.rb +5 -0
  316. data/test/models/owner.rb +4 -1
  317. data/test/models/parrot.rb +6 -7
  318. data/test/models/person.rb +0 -1
  319. data/test/models/pet.rb +3 -0
  320. data/test/models/pet_treasure.rb +6 -0
  321. data/test/models/pirate.rb +3 -3
  322. data/test/models/post.rb +18 -9
  323. data/test/models/project.rb +9 -0
  324. data/test/models/randomly_named_c1.rb +1 -1
  325. data/test/models/recipe.rb +3 -0
  326. data/test/models/ship.rb +8 -2
  327. data/test/models/tag.rb +6 -0
  328. data/test/models/topic.rb +2 -8
  329. data/test/models/tree.rb +3 -0
  330. data/test/models/tuning_peg.rb +4 -0
  331. data/test/models/user.rb +14 -0
  332. data/test/models/uuid_item.rb +6 -0
  333. data/test/schema/mysql2_specific_schema.rb +33 -23
  334. data/test/schema/oracle_specific_schema.rb +1 -4
  335. data/test/schema/postgresql_specific_schema.rb +36 -124
  336. data/test/schema/schema.rb +170 -65
  337. data/test/schema/schema.rb.original +1057 -0
  338. data/test/schema/sqlite_specific_schema.rb +1 -5
  339. data/test/support/connection.rb +1 -0
  340. data/test/support/schema_dumping_helper.rb +1 -1
  341. data/test/support/yaml_compatibility_fixtures/rails_4_1.yml +22 -0
  342. data/test/support/yaml_compatibility_fixtures/rails_4_2_0.yml +182 -0
  343. metadata +146 -30
  344. data/lib/mswin32/rb19x/ibm_db.so +0 -0
  345. data/lib/mswin32/rb21x/i386/ibm_db.so +0 -0
  346. data/lib/mswin32/rb22x/i386/ibm_db.so +0 -0
  347. data/lib/mswin32/rb23x/i386/ibm_db.so +0 -0
  348. data/test/cases/associations/deprecated_counter_cache_on_has_many_through_test.rb +0 -26
  349. data/test/cases/attribute_methods/serialization_test.rb +0 -29
  350. data/test/cases/migration/change_schema_test - Copy.rb +0 -448
  351. data/test/cases/migration/foreign_key_test - Changed.rb +0 -325
  352. data/test/cases/migration/table_and_index_test.rb +0 -24
  353. data/test/cases/relation/where_test2.rb +0 -36
  354. data/test/cases/type/decimal_test.rb +0 -56
  355. data/test/cases/type/unsigned_integer_test.rb +0 -18
  356. data/test/cases/xml_serialization_test.rb +0 -457
  357. data/test/fixtures/naked/csv/accounts.csv +0 -1
  358. data/test/schema/mysql_specific_schema.rb +0 -70
@@ -27,7 +27,7 @@ class NestedThroughAssociationsTest < ActiveRecord::TestCase
27
27
  fixtures :authors, :books, :posts, :subscriptions, :subscribers, :tags, :taggings,
28
28
  :people, :readers, :references, :jobs, :ratings, :comments, :members, :member_details,
29
29
  :member_types, :sponsors, :clubs, :organizations, :categories, :categories_posts,
30
- :categorizations, :memberships, :essays, :author_addresses
30
+ :categorizations, :memberships, :essays
31
31
 
32
32
  # Through associations can either use the has_many or has_one macros.
33
33
  #
@@ -495,7 +495,7 @@ class NestedThroughAssociationsTest < ActiveRecord::TestCase
495
495
  groucho = members(:groucho)
496
496
  founding = member_types(:founding)
497
497
 
498
- assert_raises(ActiveRecord::HasManyThroughNestedAssociationsAreReadonly) do
498
+ assert_raises(ActiveRecord::HasOneThroughNestedAssociationsAreReadonly) do
499
499
  groucho.nested_member_type = founding
500
500
  end
501
501
  end
@@ -1,7 +1,7 @@
1
1
  require "cases/helper"
2
2
 
3
3
  class RequiredAssociationsTest < ActiveRecord::TestCase
4
- self.use_transactional_fixtures = false
4
+ self.use_transactional_tests = false
5
5
 
6
6
  class Parent < ActiveRecord::Base
7
7
  end
@@ -18,8 +18,8 @@ class RequiredAssociationsTest < ActiveRecord::TestCase
18
18
  end
19
19
 
20
20
  teardown do
21
- @connection.drop_table 'parents' if @connection.table_exists? 'parents'
22
- @connection.drop_table 'children' if @connection.table_exists? 'children'
21
+ @connection.drop_table 'parents', if_exists: true
22
+ @connection.drop_table 'children', if_exists: true
23
23
  end
24
24
 
25
25
  test "belongs_to associations are not required by default" do
@@ -40,7 +40,7 @@ class RequiredAssociationsTest < ActiveRecord::TestCase
40
40
 
41
41
  record = model.new
42
42
  assert_not record.save
43
- assert_equal ["Parent can't be blank"], record.errors.full_messages
43
+ assert_equal ["Parent must exist"], record.errors.full_messages
44
44
 
45
45
  record.parent = Parent.new
46
46
  assert record.save
@@ -64,12 +64,32 @@ class RequiredAssociationsTest < ActiveRecord::TestCase
64
64
 
65
65
  record = model.new
66
66
  assert_not record.save
67
- assert_equal ["Child can't be blank"], record.errors.full_messages
67
+ assert_equal ["Child must exist"], record.errors.full_messages
68
68
 
69
69
  record.child = Child.new
70
70
  assert record.save
71
71
  end
72
72
 
73
+ test "required has_one associations have a correct error message" do
74
+ model = subclass_of(Parent) do
75
+ has_one :child, required: true, inverse_of: false,
76
+ class_name: "RequiredAssociationsTest::Child"
77
+ end
78
+
79
+ record = model.create
80
+ assert_equal ["Child must exist"], record.errors.full_messages
81
+ end
82
+
83
+ test "required belongs_to associations have a correct error message" do
84
+ model = subclass_of(Child) do
85
+ belongs_to :parent, required: true, inverse_of: false,
86
+ class_name: "RequiredAssociationsTest::Parent"
87
+ end
88
+
89
+ record = model.create
90
+ assert_equal ["Parent must exist"], record.errors.full_messages
91
+ end
92
+
73
93
  private
74
94
 
75
95
  def subclass_of(klass, &block)
@@ -1,7 +1,6 @@
1
1
  require "cases/helper"
2
2
  require 'models/computer'
3
3
  require 'models/developer'
4
- require 'models/computer'
5
4
  require 'models/project'
6
5
  require 'models/company'
7
6
  require 'models/categorization'
@@ -13,7 +12,6 @@ require 'models/tag'
13
12
  require 'models/tagging'
14
13
  require 'models/person'
15
14
  require 'models/reader'
16
- require 'models/parrot'
17
15
  require 'models/ship_part'
18
16
  require 'models/ship'
19
17
  require 'models/liquid'
@@ -24,7 +22,7 @@ require 'models/interest'
24
22
 
25
23
  class AssociationsTest < ActiveRecord::TestCase
26
24
  fixtures :accounts, :companies, :developers, :projects, :developers_projects,
27
- :computers, :people, :readers, :authors, :author_favorites, :author_addresses
25
+ :computers, :people, :readers, :authors, :author_favorites
28
26
 
29
27
  def test_eager_loading_should_not_change_count_of_children
30
28
  liquid = Liquid.create(:name => 'salty')
@@ -43,28 +41,6 @@ class AssociationsTest < ActiveRecord::TestCase
43
41
  assert_equal favs, fav2
44
42
  end
45
43
 
46
- def test_clear_association_cache_stored
47
- firm = Firm.find(1)
48
- assert_kind_of Firm, firm
49
-
50
- firm.clear_association_cache
51
- assert_equal Firm.find(1).clients.collect{ |x| x.name }.sort, firm.clients.collect{ |x| x.name }.sort
52
- end
53
-
54
- def test_clear_association_cache_new_record
55
- firm = Firm.new
56
- client_stored = Client.find(3)
57
- client_new = Client.new
58
- client_new.name = "The Joneses"
59
- clients = [ client_stored, client_new ]
60
-
61
- firm.clients << clients
62
- assert_equal clients.map(&:name).to_set, firm.clients.map(&:name).to_set
63
-
64
- firm.clear_association_cache
65
- assert_equal clients.map(&:name).to_set, firm.clients.map(&:name).to_set
66
- end
67
-
68
44
  def test_loading_the_association_target_should_keep_child_records_marked_for_destruction
69
45
  ship = Ship.create!(:name => "The good ship Dollypop")
70
46
  part = ship.parts.create!(:name => "Mast")
@@ -115,8 +91,10 @@ class AssociationsTest < ActiveRecord::TestCase
115
91
  assert firm.clients.empty?, "New firm should have cached no client objects"
116
92
  assert_equal 0, firm.clients.size, "New firm should have cached 0 clients count"
117
93
 
118
- assert !firm.clients(true).empty?, "New firm should have reloaded client objects"
119
- assert_equal 1, firm.clients(true).size, "New firm should have reloaded clients count"
94
+ ActiveSupport::Deprecation.silence do
95
+ assert !firm.clients(true).empty?, "New firm should have reloaded client objects"
96
+ assert_equal 1, firm.clients(true).size, "New firm should have reloaded clients count"
97
+ end
120
98
  end
121
99
 
122
100
  def test_using_limitable_reflections_helper
@@ -132,16 +110,19 @@ class AssociationsTest < ActiveRecord::TestCase
132
110
  def test_force_reload_is_uncached
133
111
  firm = Firm.create!("name" => "A New Firm, Inc")
134
112
  Client.create!("name" => "TheClient.com", :firm => firm)
135
- ActiveRecord::Base.cache do
136
- firm.clients.each {}
137
- assert_queries(0) { assert_not_nil firm.clients.each {} }
138
- assert_queries(1) { assert_not_nil firm.clients(true).each {} }
113
+
114
+ ActiveSupport::Deprecation.silence do
115
+ ActiveRecord::Base.cache do
116
+ firm.clients.each {}
117
+ assert_queries(0) { assert_not_nil firm.clients.each {} }
118
+ assert_queries(1) { assert_not_nil firm.clients(true).each {} }
119
+ end
139
120
  end
140
121
  end
141
122
 
142
123
  def test_association_with_references
143
124
  firm = companies(:first_firm)
144
- assert_equal ['foo'], firm.association_with_references.references_values
125
+ assert_includes firm.association_with_references.references_values, 'foo'
145
126
  end
146
127
 
147
128
  end
@@ -202,6 +183,14 @@ class AssociationProxyTest < ActiveRecord::TestCase
202
183
  assert !david.projects.loaded?
203
184
  end
204
185
 
186
+ def test_load_does_load_target
187
+ david = developers(:david)
188
+
189
+ assert !david.projects.loaded?
190
+ david.projects.load
191
+ assert david.projects.loaded?
192
+ end
193
+
205
194
  def test_inspect_does_not_reload_a_not_yet_loaded_target
206
195
  andreas = Developer.new :name => 'Andreas', :log => 'new developer added'
207
196
  assert !andreas.audit_logs.loaded?
@@ -238,7 +227,7 @@ class AssociationProxyTest < ActiveRecord::TestCase
238
227
  end
239
228
 
240
229
  def test_scoped_allows_conditions
241
- assert developers(:david).projects.merge!(where: 'foo').where_values.include?('foo')
230
+ assert developers(:david).projects.merge(where: 'foo').to_sql.include?('foo')
242
231
  end
243
232
 
244
233
  test "getting a scope from an association" do
@@ -250,7 +239,14 @@ class AssociationProxyTest < ActiveRecord::TestCase
250
239
 
251
240
  test "proxy object is cached" do
252
241
  david = developers(:david)
253
- assert david.projects.equal?(david.projects)
242
+ assert_same david.projects, david.projects
243
+ end
244
+
245
+ test "proxy object can be stubbed" do
246
+ david = developers(:david)
247
+ david.projects.define_singleton_method(:extra_method) { 42 }
248
+
249
+ assert_equal 42, david.projects.extra_method
254
250
  end
255
251
 
256
252
  test "inverses get set of subsets of the association" do
@@ -267,6 +263,15 @@ class AssociationProxyTest < ActiveRecord::TestCase
267
263
  test "first! works on loaded associations" do
268
264
  david = authors(:david)
269
265
  assert_equal david.posts.first, david.posts.reload.first!
266
+ assert david.posts.loaded?
267
+ assert_no_queries { david.posts.first! }
268
+ end
269
+
270
+ def test_pluck_uses_loaded_target
271
+ david = authors(:david)
272
+ assert_equal david.posts.pluck(:title), david.posts.load.pluck(:title)
273
+ assert david.posts.loaded?
274
+ assert_no_queries { david.posts.pluck(:title) }
270
275
  end
271
276
 
272
277
  def test_reset_unloads_target
@@ -12,11 +12,11 @@ module ActiveRecord
12
12
  super(delegate)
13
13
  end
14
14
 
15
- def type_cast_from_user(value)
15
+ def cast(value)
16
16
  "#{super} #{@decoration}"
17
17
  end
18
18
 
19
- alias type_cast_from_database type_cast_from_user
19
+ alias deserialize cast
20
20
  end
21
21
 
22
22
  setup do
@@ -28,7 +28,8 @@ module ActiveRecord
28
28
 
29
29
  teardown do
30
30
  return unless @connection
31
- @connection.drop_table 'attribute_decorators_model' if @connection.table_exists? 'attribute_decorators_model'
31
+ @connection.drop_table 'attribute_decorators_model'
32
+ #, if_exists: true
32
33
  Model.attribute_type_decorations.clear
33
34
  Model.reset_column_information
34
35
  end
@@ -51,7 +52,7 @@ module ActiveRecord
51
52
  end
52
53
 
53
54
  test "undecorated columns are not touched" do
54
- Model.attribute :another_string, Type::String.new, default: 'something or other'
55
+ Model.attribute :another_string, :string, default: 'something or other'
55
56
  Model.decorate_attribute_type(:a_string, :test) { |t| StringDecorator.new(t) }
56
57
 
57
58
  assert_equal 'something or other', Model.new.another_string
@@ -86,7 +87,7 @@ module ActiveRecord
86
87
  end
87
88
 
88
89
  test "decorating attributes does not modify parent classes" do
89
- Model.attribute :another_string, Type::String.new, default: 'whatever'
90
+ Model.attribute :another_string, :string, default: 'whatever'
90
91
  Model.decorate_attribute_type(:a_string, :test) { |t| StringDecorator.new(t) }
91
92
  child_class = Class.new(Model)
92
93
  child_class.decorate_attribute_type(:another_string, :test) { |t| StringDecorator.new(t) }
@@ -102,15 +103,15 @@ module ActiveRecord
102
103
  end
103
104
 
104
105
  class Multiplier < SimpleDelegator
105
- def type_cast_from_user(value)
106
+ def cast(value)
106
107
  return if value.nil?
107
108
  value * 2
108
109
  end
109
- alias type_cast_from_database type_cast_from_user
110
+ alias deserialize cast
110
111
  end
111
112
 
112
113
  test "decorating with a proc" do
113
- Model.attribute :an_int, Type::Integer.new
114
+ Model.attribute :an_int, :integer
114
115
  type_is_integer = proc { |_, type| type.type == :integer }
115
116
  Model.decorate_matching_attribute_types type_is_integer, :multiplier do |type|
116
117
  Multiplier.new(type)
@@ -17,7 +17,7 @@ module ActiveRecord
17
17
 
18
18
  include ActiveRecord::AttributeMethods
19
19
 
20
- def self.column_names
20
+ def self.attribute_names
21
21
  %w{ one two three }
22
22
  end
23
23
 
@@ -25,11 +25,11 @@ module ActiveRecord
25
25
  end
26
26
 
27
27
  def self.columns
28
- column_names.map { FakeColumn.new(name) }
28
+ attribute_names.map { FakeColumn.new(name) }
29
29
  end
30
30
 
31
31
  def self.columns_hash
32
- Hash[column_names.map { |name|
32
+ Hash[attribute_names.map { |name|
33
33
  [name, FakeColumn.new(name)]
34
34
  }]
35
35
  end
@@ -39,13 +39,13 @@ module ActiveRecord
39
39
  def test_define_attribute_methods
40
40
  instance = @klass.new
41
41
 
42
- @klass.column_names.each do |name|
42
+ @klass.attribute_names.each do |name|
43
43
  assert !instance.methods.map(&:to_s).include?(name)
44
44
  end
45
45
 
46
46
  @klass.define_attribute_methods
47
47
 
48
- @klass.column_names.each do |name|
48
+ @klass.attribute_names.each do |name|
49
49
  assert instance.methods.map(&:to_s).include?(name), "#{name} is not defined"
50
50
  end
51
51
  end
@@ -1,7 +1,6 @@
1
1
  require "cases/helper"
2
2
  require 'models/minimalistic'
3
3
  require 'models/developer'
4
- require 'models/computer'
5
4
  require 'models/auto_id'
6
5
  require 'models/boolean'
7
6
  require 'models/computer'
@@ -28,14 +27,33 @@ class AttributeMethodsTest < ActiveRecord::TestCase
28
27
  ActiveRecord::Base.send(:attribute_method_matchers).concat(@old_matchers)
29
28
  end
30
29
 
31
- def test_attribute_for_inspect
30
+ def test_attribute_for_inspect_string
32
31
  t = topics(:first)
33
32
  t.title = "The First Topic Now Has A Title With\nNewlines And More Than 50 Characters"
34
33
 
35
- assert_equal %("#{t.written_on.to_s(:db)}"), t.attribute_for_inspect(:written_on)
36
34
  assert_equal '"The First Topic Now Has A Title With\nNewlines And ..."', t.attribute_for_inspect(:title)
37
35
  end
38
36
 
37
+ def test_attribute_for_inspect_date
38
+ t = topics(:first)
39
+
40
+ assert_equal %("#{t.written_on.to_s(:db)}"), t.attribute_for_inspect(:written_on)
41
+ end
42
+
43
+ def test_attribute_for_inspect_array
44
+ t = topics(:first)
45
+ t.content = [Object.new]
46
+
47
+ assert_match %r(\[#<Object:0x[0-9a-f]+>\]), t.attribute_for_inspect(:content)
48
+ end
49
+
50
+ def test_attribute_for_inspect_long_array
51
+ t = topics(:first)
52
+ t.content = (1..11).to_a
53
+
54
+ assert_equal "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]", t.attribute_for_inspect(:content)
55
+ end
56
+
39
57
  def test_attribute_present
40
58
  t = Topic.new
41
59
  t.title = "hello there!"
@@ -67,8 +85,9 @@ class AttributeMethodsTest < ActiveRecord::TestCase
67
85
 
68
86
  def test_caching_nil_primary_key
69
87
  klass = Class.new(Minimalistic)
70
- klass.expects(:reset_primary_key).returns(nil).once
71
- 2.times { klass.primary_key }
88
+ assert_called(klass, :reset_primary_key, returns: nil) do
89
+ 2.times { klass.primary_key }
90
+ end
72
91
  end
73
92
 
74
93
  def test_attribute_keys_on_new_instance
@@ -175,9 +194,9 @@ class AttributeMethodsTest < ActiveRecord::TestCase
175
194
  assert_equal category_attrs , category.attributes_before_type_cast
176
195
  end
177
196
 
178
- if current_adapter?(:MysqlAdapter)
197
+ if current_adapter?(:Mysql2Adapter)
179
198
  def test_read_attributes_before_type_cast_on_boolean
180
- bool = Boolean.create({ "value" => false })
199
+ bool = Boolean.create!({ "value" => false })
181
200
  if RUBY_PLATFORM =~ /java/
182
201
  # JRuby will return the value before typecast as string
183
202
  assert_equal "0", bool.reload.attributes_before_type_cast["value"]
@@ -253,7 +272,7 @@ class AttributeMethodsTest < ActiveRecord::TestCase
253
272
 
254
273
  def test_case_sensitive_attributes_hash
255
274
  # DB2 is not case-sensitive
256
- return true if current_adapter?(:DB2Adapter) || current_adapter?(:IBM_DBAdapter)
275
+ return true if current_adapter?(:DB2Adapter)
257
276
 
258
277
  assert_equal @loaded_fixtures['computers']['workstation'].to_hash, Computer.first.attributes
259
278
  end
@@ -502,7 +521,7 @@ class AttributeMethodsTest < ActiveRecord::TestCase
502
521
  def test_typecast_attribute_from_select_to_false
503
522
  Topic.create(:title => 'Budget')
504
523
  # Oracle does not support boolean expressions in SELECT
505
- if current_adapter?(:OracleAdapter) || current_adapter?(:IBM_DBAdapter)
524
+ if current_adapter?(:OracleAdapter, :FbAdapter)
506
525
  topic = Topic.all.merge!(:select => "topics.*, 0 as is_test").first
507
526
  else
508
527
  topic = Topic.all.merge!(:select => "topics.*, 1=2 as is_test").first
@@ -513,7 +532,7 @@ class AttributeMethodsTest < ActiveRecord::TestCase
513
532
  def test_typecast_attribute_from_select_to_true
514
533
  Topic.create(:title => 'Budget')
515
534
  # Oracle does not support boolean expressions in SELECT
516
- if current_adapter?(:OracleAdapter) || current_adapter?(:IBM_DBAdapter)
535
+ if current_adapter?(:OracleAdapter, :FbAdapter)
517
536
  topic = Topic.all.merge!(:select => "topics.*, 1 as is_test").first
518
537
  else
519
538
  topic = Topic.all.merge!(:select => "topics.*, 2=2 as is_test").first
@@ -531,20 +550,6 @@ class AttributeMethodsTest < ActiveRecord::TestCase
531
550
  end
532
551
  end
533
552
 
534
- def test_deprecated_cache_attributes
535
- assert_deprecated do
536
- Topic.cache_attributes :replies_count
537
- end
538
-
539
- assert_deprecated do
540
- Topic.cached_attributes
541
- end
542
-
543
- assert_deprecated do
544
- Topic.cache_attribute? :replies_count
545
- end
546
- end
547
-
548
553
  def test_converted_values_are_returned_after_assignment
549
554
  developer = Developer.new(name: 1337, salary: "50000")
550
555
 
@@ -556,9 +561,6 @@ class AttributeMethodsTest < ActiveRecord::TestCase
556
561
 
557
562
  developer.save!
558
563
 
559
- assert_equal "50000", developer.salary_before_type_cast
560
- assert_equal 1337, developer.name_before_type_cast
561
-
562
564
  assert_equal 50000, developer.salary
563
565
  assert_equal "1337", developer.name
564
566
  end
@@ -671,7 +673,7 @@ class AttributeMethodsTest < ActiveRecord::TestCase
671
673
  end
672
674
  end
673
675
 
674
- def test_setting_time_zone_aware_attribute_in_current_time_zone
676
+ def test_setting_time_zone_aware_datetime_in_current_time_zone
675
677
  utc_time = Time.utc(2008, 1, 1)
676
678
  in_time_zone "Pacific Time (US & Canada)" do
677
679
  record = @target.new
@@ -690,6 +692,54 @@ class AttributeMethodsTest < ActiveRecord::TestCase
690
692
  end
691
693
  end
692
694
 
695
+ def test_setting_time_zone_aware_time_in_current_time_zone
696
+ in_time_zone "Pacific Time (US & Canada)" do
697
+ record = @target.new
698
+ time_string = "10:00:00"
699
+ expected_time = Time.zone.parse("2000-01-01 #{time_string}")
700
+
701
+ record.bonus_time = time_string
702
+ assert_equal expected_time, record.bonus_time
703
+ assert_equal ActiveSupport::TimeZone["Pacific Time (US & Canada)"], record.bonus_time.time_zone
704
+
705
+ record.bonus_time = ''
706
+ assert_nil record.bonus_time
707
+ end
708
+ end
709
+
710
+ def test_setting_time_zone_aware_time_with_dst
711
+ in_time_zone "Pacific Time (US & Canada)" do
712
+ current_time = Time.zone.local(2014, 06, 15, 10)
713
+ record = @target.new(bonus_time: current_time)
714
+ time_before_save = record.bonus_time
715
+
716
+ record.save
717
+ record.reload
718
+
719
+ assert_equal time_before_save, record.bonus_time
720
+ assert_equal ActiveSupport::TimeZone["Pacific Time (US & Canada)"], record.bonus_time.time_zone
721
+ end
722
+ end
723
+
724
+ def test_removing_time_zone_aware_types
725
+ with_time_zone_aware_types(:datetime) do
726
+ in_time_zone "Pacific Time (US & Canada)" do
727
+ record = @target.new(bonus_time: "10:00:00")
728
+ expected_time = Time.utc(2000, 01, 01, 10)
729
+
730
+ assert_equal expected_time, record.bonus_time
731
+ assert record.bonus_time.utc?
732
+ end
733
+ end
734
+ end
735
+
736
+ def test_time_zone_aware_attributes_dont_recurse_infinitely_on_invalid_values
737
+ in_time_zone "Pacific Time (US & Canada)" do
738
+ record = @target.new(bonus_time: [])
739
+ assert_equal nil, record.bonus_time
740
+ end
741
+ end
742
+
693
743
  def test_setting_time_zone_conversion_for_attributes_should_write_value_on_class_variable
694
744
  Topic.skip_time_zone_conversion_for_attributes = [:field_a]
695
745
  Minimalistic.skip_time_zone_conversion_for_attributes = [:field_b]
@@ -744,17 +794,6 @@ class AttributeMethodsTest < ActiveRecord::TestCase
744
794
  assert_equal "unknown attribute 'hello' for Topic.", error.message
745
795
  end
746
796
 
747
- # This test is related to a bug in Ruby 2.2.1.
748
- # It can be safely removed once that bug is fixed.
749
- #
750
- # xref: https://bugs.ruby-lang.org/issues/10969
751
- def test_bulk_does_not_raise_name_error
752
- nope rescue nil # necessary to trigger the bug
753
- assert_raises(ActiveRecord::UnknownAttributeError) {
754
- Topic.new(hello: "world")
755
- }
756
- end
757
-
758
797
  def test_methods_override_in_multi_level_subclass
759
798
  klass = Class.new(Developer) do
760
799
  def name
@@ -778,7 +817,7 @@ class AttributeMethodsTest < ActiveRecord::TestCase
778
817
  assert_nil computer.system
779
818
  end
780
819
 
781
- def test_global_methods_are_overwritte_when_subclassing
820
+ def test_global_methods_are_overwritten_when_subclassing
782
821
  klass = Class.new(ActiveRecord::Base) { self.abstract_class = true }
783
822
 
784
823
  subklass = Class.new(klass) do
@@ -921,6 +960,16 @@ class AttributeMethodsTest < ActiveRecord::TestCase
921
960
  assert model.id_came_from_user?
922
961
  end
923
962
 
963
+ def test_accessed_fields
964
+ model = @target.first
965
+
966
+ assert_equal [], model.accessed_fields
967
+
968
+ model.title
969
+
970
+ assert_equal ["title"], model.accessed_fields
971
+ end
972
+
924
973
  private
925
974
 
926
975
  def new_topic_like_ar_class(&block)
@@ -933,6 +982,14 @@ class AttributeMethodsTest < ActiveRecord::TestCase
933
982
  klass
934
983
  end
935
984
 
985
+ def with_time_zone_aware_types(*types)
986
+ old_types = ActiveRecord::Base.time_zone_aware_types
987
+ ActiveRecord::Base.time_zone_aware_types = types
988
+ yield
989
+ ensure
990
+ ActiveRecord::Base.time_zone_aware_types = old_types
991
+ end
992
+
936
993
  def cached_columns
937
994
  Topic.columns.map(&:name)
938
995
  end