active_scaffold 3.7.12 → 4.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +9 -23
  3. data/README.md +3 -2
  4. data/app/assets/config/active_scaffold_manifest.js +3 -0
  5. data/app/assets/javascripts/active_scaffold.js.erb +24 -34
  6. data/app/assets/javascripts/jquery/active_scaffold.js +41 -58
  7. data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +1 -1
  8. data/app/assets/stylesheets/active_scaffold_colors.scss +0 -7
  9. data/app/assets/stylesheets/active_scaffold_extensions.css.erb +2 -2
  10. data/app/assets/stylesheets/active_scaffold_jquery_ui.css.erb +7 -7
  11. data/app/assets/stylesheets/active_scaffold_layout.css +57 -30
  12. data/app/views/active_scaffold_overrides/_add_existing_form.html.erb +10 -10
  13. data/app/views/active_scaffold_overrides/_base_form.html.erb +21 -21
  14. data/app/views/active_scaffold_overrides/_create_form.html.erb +10 -7
  15. data/app/views/active_scaffold_overrides/_create_form_on_list.html.erb +5 -5
  16. data/app/views/active_scaffold_overrides/_field_search.html.erb +6 -6
  17. data/app/views/active_scaffold_overrides/_form.html.erb +11 -14
  18. data/app/views/active_scaffold_overrides/_form_association.html.erb +21 -12
  19. data/app/views/active_scaffold_overrides/_form_association_footer.html.erb +19 -10
  20. data/app/views/active_scaffold_overrides/_form_association_record.html.erb +15 -21
  21. data/app/views/active_scaffold_overrides/_form_messages.html.erb +2 -2
  22. data/app/views/active_scaffold_overrides/_horizontal_subform.html.erb +7 -6
  23. data/app/views/active_scaffold_overrides/_human_conditions.html.erb +2 -2
  24. data/app/views/active_scaffold_overrides/_list.html.erb +15 -8
  25. data/app/views/active_scaffold_overrides/_list_calculations.html.erb +2 -3
  26. data/app/views/active_scaffold_overrides/_list_header.html.erb +2 -2
  27. data/app/views/active_scaffold_overrides/_list_inline_adapter.html.erb +5 -5
  28. data/app/views/active_scaffold_overrides/_list_messages.html.erb +12 -3
  29. data/app/views/active_scaffold_overrides/_list_pagination.html.erb +3 -3
  30. data/app/views/active_scaffold_overrides/_list_pagination_links.html.erb +4 -4
  31. data/app/views/active_scaffold_overrides/_list_record.html.erb +6 -6
  32. data/app/views/active_scaffold_overrides/_list_with_header.html.erb +4 -4
  33. data/app/views/active_scaffold_overrides/_messages.html.erb +1 -1
  34. data/app/views/active_scaffold_overrides/_refresh_list.js.erb +2 -2
  35. data/app/views/active_scaffold_overrides/_render_field.js.erb +4 -4
  36. data/app/views/active_scaffold_overrides/_row.html.erb +1 -1
  37. data/app/views/active_scaffold_overrides/_search.html.erb +6 -5
  38. data/app/views/active_scaffold_overrides/_show.html.erb +3 -3
  39. data/app/views/active_scaffold_overrides/_show_actions.html.erb +1 -1
  40. data/app/views/active_scaffold_overrides/_show_association.html.erb +1 -1
  41. data/app/views/active_scaffold_overrides/_show_association_horizontal.html.erb +1 -1
  42. data/app/views/active_scaffold_overrides/_show_association_vertical.html.erb +1 -1
  43. data/app/views/active_scaffold_overrides/_show_columns.html.erb +1 -1
  44. data/app/views/active_scaffold_overrides/_show_horizontal_record.html.erb +1 -1
  45. data/app/views/active_scaffold_overrides/_update_actions.html.erb +1 -1
  46. data/app/views/active_scaffold_overrides/_update_calculations.js.erb +2 -2
  47. data/app/views/active_scaffold_overrides/_update_column.js.erb +8 -7
  48. data/app/views/active_scaffold_overrides/_update_form.html.erb +5 -5
  49. data/app/views/active_scaffold_overrides/_update_messages.js.erb +1 -1
  50. data/app/views/active_scaffold_overrides/_vertical_subform.html.erb +4 -3
  51. data/app/views/active_scaffold_overrides/action_confirmation.html.erb +3 -3
  52. data/app/views/active_scaffold_overrides/add_existing.js.erb +6 -6
  53. data/app/views/active_scaffold_overrides/add_existing_form.html.erb +1 -1
  54. data/app/views/active_scaffold_overrides/add_tab.js.erb +15 -0
  55. data/app/views/active_scaffold_overrides/create.html.erb +1 -1
  56. data/app/views/active_scaffold_overrides/delete.html.erb +4 -4
  57. data/app/views/active_scaffold_overrides/destroy.js.erb +15 -13
  58. data/app/views/active_scaffold_overrides/edit_associated.js.erb +3 -3
  59. data/app/views/active_scaffold_overrides/field_search.html.erb +1 -1
  60. data/app/views/active_scaffold_overrides/form_messages.js.erb +1 -1
  61. data/app/views/active_scaffold_overrides/list.html.erb +1 -1
  62. data/app/views/active_scaffold_overrides/on_action_update.js.erb +13 -8
  63. data/app/views/active_scaffold_overrides/on_create.js.erb +34 -6
  64. data/app/views/active_scaffold_overrides/on_mark.js.erb +3 -3
  65. data/app/views/active_scaffold_overrides/on_update.js.erb +9 -9
  66. data/app/views/active_scaffold_overrides/render_field.js.erb +1 -1
  67. data/app/views/active_scaffold_overrides/render_field_inplace.html.erb +1 -1
  68. data/app/views/active_scaffold_overrides/row.js.erb +2 -2
  69. data/app/views/active_scaffold_overrides/search.html.erb +1 -1
  70. data/app/views/active_scaffold_overrides/show.html.erb +3 -3
  71. data/app/views/active_scaffold_overrides/update.html.erb +2 -2
  72. data/app/views/active_scaffold_overrides/update_column.js.erb +4 -4
  73. data/app/views/active_scaffold_overrides/update_row.js.erb +1 -1
  74. data/lib/active_scaffold/actions/common_search.rb +5 -3
  75. data/lib/active_scaffold/actions/core.rb +57 -32
  76. data/lib/active_scaffold/actions/create.rb +19 -17
  77. data/lib/active_scaffold/actions/delete.rb +10 -12
  78. data/lib/active_scaffold/actions/field_search.rb +28 -13
  79. data/lib/active_scaffold/actions/list.rb +34 -34
  80. data/lib/active_scaffold/actions/mark.rb +5 -5
  81. data/lib/active_scaffold/actions/nested.rb +64 -56
  82. data/lib/active_scaffold/actions/search.rb +2 -2
  83. data/lib/active_scaffold/actions/show.rb +5 -5
  84. data/lib/active_scaffold/actions/subform.rb +15 -4
  85. data/lib/active_scaffold/actions/update.rb +20 -20
  86. data/lib/active_scaffold/active_record_permissions.rb +4 -3
  87. data/lib/active_scaffold/attribute_params.rb +51 -50
  88. data/lib/active_scaffold/bridges/active_storage/active_storage_bridge.rb +4 -4
  89. data/lib/active_scaffold/bridges/active_storage/active_storage_helpers.rb +6 -2
  90. data/lib/active_scaffold/bridges/active_storage.rb +1 -1
  91. data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +3 -3
  92. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +4 -1
  93. data/lib/active_scaffold/bridges/bitfields.rb +1 -1
  94. data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +9 -8
  95. data/lib/active_scaffold/bridges/cancan.rb +8 -8
  96. data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +1 -1
  97. data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +4 -3
  98. data/lib/active_scaffold/bridges/carrierwave.rb +2 -2
  99. data/lib/active_scaffold/bridges/chosen.rb +1 -5
  100. data/lib/active_scaffold/bridges/country_select/country_select_bridge_helper.rb +4 -2
  101. data/lib/active_scaffold/bridges/date_picker/ext.rb +20 -12
  102. data/lib/active_scaffold/bridges/date_picker/helper.rb +37 -33
  103. data/lib/active_scaffold/bridges/date_picker.rb +1 -4
  104. data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +1 -1
  105. data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +3 -2
  106. data/lib/active_scaffold/bridges/dragonfly.rb +1 -1
  107. data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +3 -2
  108. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +2 -1
  109. data/lib/active_scaffold/bridges/file_column/form_ui.rb +4 -9
  110. data/lib/active_scaffold/bridges/file_column/list_ui.rb +6 -3
  111. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +3 -3
  112. data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +1 -4
  113. data/lib/active_scaffold/bridges/file_column.rb +1 -0
  114. data/lib/active_scaffold/bridges/paper_trail/actions.rb +4 -2
  115. data/lib/active_scaffold/bridges/paper_trail/config.rb +1 -1
  116. data/lib/active_scaffold/bridges/paper_trail/helper.rb +1 -1
  117. data/lib/active_scaffold/bridges/paper_trail/paper_trail_bridge.rb +2 -1
  118. data/lib/active_scaffold/bridges/paperclip/list_ui.rb +3 -2
  119. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +1 -1
  120. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +10 -9
  121. data/lib/active_scaffold/bridges/paperclip.rb +2 -1
  122. data/lib/active_scaffold/bridges/record_select/helpers.rb +10 -11
  123. data/lib/active_scaffold/bridges/semantic_attributes/column.rb +3 -1
  124. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +3 -7
  125. data/lib/active_scaffold/bridges/tiny_mce.rb +2 -7
  126. data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +7 -7
  127. data/lib/active_scaffold/bridges.rb +7 -5
  128. data/lib/active_scaffold/config/base.rb +20 -24
  129. data/lib/active_scaffold/config/core.rb +27 -39
  130. data/lib/active_scaffold/config/create.rb +1 -1
  131. data/lib/active_scaffold/config/delete.rb +9 -9
  132. data/lib/active_scaffold/config/field_search.rb +4 -9
  133. data/lib/active_scaffold/config/form.rb +3 -1
  134. data/lib/active_scaffold/config/list.rb +19 -15
  135. data/lib/active_scaffold/config/nested.rb +2 -2
  136. data/lib/active_scaffold/config/search.rb +5 -5
  137. data/lib/active_scaffold/config/show.rb +1 -1
  138. data/lib/active_scaffold/config/subform.rb +1 -1
  139. data/lib/active_scaffold/config/update.rb +4 -5
  140. data/lib/active_scaffold/configurable.rb +2 -1
  141. data/lib/active_scaffold/constraints.rb +16 -11
  142. data/lib/active_scaffold/core.rb +25 -27
  143. data/lib/active_scaffold/data_structures/action_columns.rb +10 -3
  144. data/lib/active_scaffold/data_structures/action_link.rb +19 -9
  145. data/lib/active_scaffold/data_structures/action_links.rb +20 -26
  146. data/lib/active_scaffold/data_structures/actions.rb +3 -3
  147. data/lib/active_scaffold/data_structures/association/abstract.rb +8 -4
  148. data/lib/active_scaffold/data_structures/association/active_mongoid.rb +1 -0
  149. data/lib/active_scaffold/data_structures/association/active_record.rb +1 -4
  150. data/lib/active_scaffold/data_structures/column.rb +368 -327
  151. data/lib/active_scaffold/data_structures/columns.rb +3 -2
  152. data/lib/active_scaffold/data_structures/nested_info.rb +6 -5
  153. data/lib/active_scaffold/data_structures/proxy_column.rb +68 -0
  154. data/lib/active_scaffold/data_structures/set.rb +7 -4
  155. data/lib/active_scaffold/data_structures/sorting.rb +21 -12
  156. data/lib/active_scaffold/engine.rb +12 -12
  157. data/lib/active_scaffold/extensions/action_controller_rendering.rb +5 -5
  158. data/lib/active_scaffold/extensions/action_controller_rescueing.rb +1 -1
  159. data/lib/active_scaffold/extensions/action_view_rendering.rb +29 -31
  160. data/lib/active_scaffold/extensions/ice_nine.rb +2 -1
  161. data/lib/active_scaffold/extensions/localize.rb +2 -2
  162. data/lib/active_scaffold/extensions/name_option_for_datetime.rb +1 -1
  163. data/lib/active_scaffold/extensions/routing_mapper.rb +5 -4
  164. data/lib/active_scaffold/extensions/unsaved_associated.rb +3 -2
  165. data/lib/active_scaffold/finder.rb +71 -78
  166. data/lib/active_scaffold/helpers/action_link_helpers.rb +37 -49
  167. data/lib/active_scaffold/helpers/association_helpers.rb +3 -2
  168. data/lib/active_scaffold/helpers/controller_helpers.rb +18 -16
  169. data/lib/active_scaffold/helpers/form_column_helpers.rb +69 -53
  170. data/lib/active_scaffold/helpers/human_condition_helpers.rb +17 -15
  171. data/lib/active_scaffold/helpers/id_helpers.rb +5 -5
  172. data/lib/active_scaffold/helpers/list_column_helpers.rb +35 -38
  173. data/lib/active_scaffold/helpers/pagination_helpers.rb +4 -4
  174. data/lib/active_scaffold/helpers/search_column_helpers.rb +25 -34
  175. data/lib/active_scaffold/helpers/show_column_helpers.rb +7 -4
  176. data/lib/active_scaffold/helpers/tabs_helpers.rb +88 -0
  177. data/lib/active_scaffold/helpers/view_helpers.rb +15 -13
  178. data/lib/active_scaffold/marked_model.rb +1 -2
  179. data/lib/active_scaffold/orm_checks.rb +6 -4
  180. data/lib/active_scaffold/paginator.rb +3 -2
  181. data/lib/active_scaffold/registry.rb +5 -0
  182. data/lib/active_scaffold/tableless.rb +24 -14
  183. data/lib/active_scaffold/version.rb +4 -4
  184. data/lib/active_scaffold.rb +8 -34
  185. data/lib/generators/active_scaffold/controller_generator.rb +20 -20
  186. data/lib/generators/active_scaffold/install_generator.rb +4 -8
  187. data/lib/generators/active_scaffold/resource_generator.rb +31 -31
  188. data/lib/tasks/brakeman.rake +1 -1
  189. data/shoulda_macros/macros.rb +14 -14
  190. metadata +11 -232
  191. data/app/assets/javascripts/prototype/active_scaffold.js +0 -1249
  192. data/app/assets/javascripts/prototype/active_scaffold_chosen.js +0 -0
  193. data/app/assets/javascripts/prototype/dhtml_history.js +0 -870
  194. data/app/assets/javascripts/prototype/form_enhancements.js +0 -117
  195. data/app/assets/javascripts/prototype/tiny_mce_bridge.js +0 -17
  196. data/app/views/active_scaffold_overrides/_list_messages_content.html.erb +0 -8
  197. data/app/views/active_scaffold_overrides/_new_record.js.erb +0 -15
  198. data/app/views/active_scaffold_overrides/_popup_adapter.html.erb +0 -20
  199. data/app/views/active_scaffold_overrides/_refresh_create_form.js.erb +0 -12
  200. data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +0 -58
  201. data/lib/active_scaffold/bridges/calendar_date_select.rb +0 -17
  202. data/lib/active_scaffold/data_structures/action_link_separator.rb +0 -13
  203. data/lib/active_scaffold/extensions/cow_proxy.rb +0 -102
  204. data/test/active_scaffold_config_mock.rb +0 -33
  205. data/test/bridges/bridge_test.rb +0 -88
  206. data/test/bridges/date_picker_test.rb +0 -31
  207. data/test/bridges/paper_trail_test.rb +0 -16
  208. data/test/bridges/paperclip_test.rb +0 -85
  209. data/test/bridges/tiny_mce_test.rb +0 -61
  210. data/test/class_with_finder.rb +0 -42
  211. data/test/company.rb +0 -97
  212. data/test/config/base_test.rb +0 -17
  213. data/test/config/core_test.rb +0 -66
  214. data/test/config/create_test.rb +0 -72
  215. data/test/config/delete_test.rb +0 -35
  216. data/test/config/field_search_test.rb +0 -49
  217. data/test/config/list_test.rb +0 -134
  218. data/test/config/nested_test.rb +0 -55
  219. data/test/config/search_test.rb +0 -62
  220. data/test/config/show_test.rb +0 -45
  221. data/test/config/subform_test.rb +0 -19
  222. data/test/config/update_test.rb +0 -52
  223. data/test/const_mocker.rb +0 -32
  224. data/test/data_structures/action_columns_test.rb +0 -112
  225. data/test/data_structures/action_link_test.rb +0 -79
  226. data/test/data_structures/action_links_test.rb +0 -78
  227. data/test/data_structures/actions_test.rb +0 -25
  228. data/test/data_structures/association_column_test.rb +0 -41
  229. data/test/data_structures/column_test.rb +0 -186
  230. data/test/data_structures/columns_test.rb +0 -68
  231. data/test/data_structures/set_test.rb +0 -84
  232. data/test/data_structures/sorting_test.rb +0 -148
  233. data/test/data_structures/standard_column_test.rb +0 -23
  234. data/test/data_structures/validation_reflection_test.rb +0 -69
  235. data/test/data_structures/virtual_column_test.rb +0 -23
  236. data/test/extensions/action_view_rendering_test.rb +0 -20
  237. data/test/extensions/active_record_test.rb +0 -44
  238. data/test/extensions/routing_mapper_test.rb +0 -73
  239. data/test/helpers/form_column_helpers_test.rb +0 -34
  240. data/test/helpers/list_column_helpers_test.rb +0 -53
  241. data/test/helpers/pagination_helpers_test.rb +0 -65
  242. data/test/helpers/search_column_helpers_test.rb +0 -15
  243. data/test/misc/active_record_permissions_test.rb +0 -193
  244. data/test/misc/attribute_params_test.rb +0 -460
  245. data/test/misc/calculation_test.rb +0 -39
  246. data/test/misc/configurable_test.rb +0 -97
  247. data/test/misc/constraints_test.rb +0 -209
  248. data/test/misc/convert_numbers_format_test.rb +0 -171
  249. data/test/misc/finder_test.rb +0 -124
  250. data/test/misc/lang_test.rb +0 -10
  251. data/test/misc/parse_datetime_test.rb +0 -159
  252. data/test/misc/render_test.rb +0 -9
  253. data/test/misc/tableless_test.rb +0 -56
  254. data/test/mock_app/.gitignore +0 -2
  255. data/test/mock_app/Rakefile +0 -7
  256. data/test/mock_app/app/assets/config/manifest.js +0 -0
  257. data/test/mock_app/app/controllers/addresses_controller.rb +0 -4
  258. data/test/mock_app/app/controllers/application_controller.rb +0 -10
  259. data/test/mock_app/app/controllers/buildings_controller.rb +0 -4
  260. data/test/mock_app/app/controllers/cars_controller.rb +0 -5
  261. data/test/mock_app/app/controllers/contacts_controller.rb +0 -4
  262. data/test/mock_app/app/controllers/floors_controller.rb +0 -6
  263. data/test/mock_app/app/controllers/people_controller.rb +0 -8
  264. data/test/mock_app/app/controllers/roles_controller.rb +0 -4
  265. data/test/mock_app/app/helpers/application_helper.rb +0 -3
  266. data/test/mock_app/app/models/address.rb +0 -3
  267. data/test/mock_app/app/models/building.rb +0 -9
  268. data/test/mock_app/app/models/car.rb +0 -3
  269. data/test/mock_app/app/models/contact.rb +0 -3
  270. data/test/mock_app/app/models/file_model.rb +0 -31
  271. data/test/mock_app/app/models/floor.rb +0 -8
  272. data/test/mock_app/app/models/person.rb +0 -12
  273. data/test/mock_app/app/models/role.rb +0 -3
  274. data/test/mock_app/app/views/active_scaffold_overrides/_form.html.erb +0 -2
  275. data/test/mock_app/app/views/active_scaffold_overrides/list.html.erb +0 -2
  276. data/test/mock_app/app/views/people/_first_name_form_column.html.erb +0 -2
  277. data/test/mock_app/app/views/people/_form.html.erb +0 -2
  278. data/test/mock_app/app/views/people/list.html.erb +0 -2
  279. data/test/mock_app/config/application.rb +0 -14
  280. data/test/mock_app/config/boot.rb +0 -7
  281. data/test/mock_app/config/database.yml +0 -16
  282. data/test/mock_app/config/environment.rb +0 -6
  283. data/test/mock_app/config/environments/development.rb +0 -24
  284. data/test/mock_app/config/environments/production.rb +0 -49
  285. data/test/mock_app/config/environments/test.rb +0 -34
  286. data/test/mock_app/config/initializers/backtrace_silencers.rb +0 -7
  287. data/test/mock_app/config/initializers/inflections.rb +0 -10
  288. data/test/mock_app/config/initializers/mime_types.rb +0 -5
  289. data/test/mock_app/config/initializers/secret_token.rb +0 -11
  290. data/test/mock_app/config/initializers/session_store.rb +0 -8
  291. data/test/mock_app/config/initializers/wrap_parameters.rb +0 -14
  292. data/test/mock_app/config/locales/en.yml +0 -5
  293. data/test/mock_app/config/routes.rb +0 -17
  294. data/test/mock_app/config.ru +0 -4
  295. data/test/mock_app/db/schema.rb +0 -68
  296. data/test/mock_app/db/test.sqlite3 +0 -1
  297. data/test/model_stub.rb +0 -64
  298. data/test/performance/list_cars_performance_test.rb +0 -34
  299. data/test/performance/list_people_performance_test.rb +0 -31
  300. data/test/performance_test_help.rb +0 -3
  301. data/test/run_all.rb +0 -6
  302. data/test/test_helper.rb +0 -71
  303. data/vendor/assets/javascripts/getprototypeof.js +0 -12
@@ -1,56 +0,0 @@
1
- require 'test_helper'
2
-
3
- class TablelessTest < Minitest::Test
4
- def test_find_all
5
- assert FileModel.all.to_a.empty?
6
- end
7
-
8
- def test_where
9
- assert FileModel.where(name: 'file').to_a.empty?
10
- end
11
-
12
- def test_where_using_assoc
13
- assert FileModel.includes(:person).where(people: {name: 'Name'}).to_a.empty?
14
- end
15
-
16
- def test_count
17
- assert_equal 0, FileModel.count
18
- end
19
-
20
- def test_find_by_id
21
- assert_raises ActiveRecord::RecordNotFound do
22
- FileModel.find('filename')
23
- end
24
- end
25
-
26
- def test_find_with_association
27
- assert Person.new.files.empty?
28
- @person = Person.new
29
- @person.save(validate: false)
30
- assert !@person.files.empty?
31
- assert @person.files.all.exists?
32
- assert_equal @person.id, @person.files.first.person_id
33
- end
34
-
35
- def test_tableless_assoc_with_dependent
36
- @person = Person.new
37
- @person.save(validate: false)
38
- assert @person.destroy
39
- end
40
-
41
- def test_find_with_through_association
42
- assert Building.new.files.empty?
43
- @building = Building.new
44
- @building.save(validate: false)
45
- assert @building.files.empty?
46
- assert_equal [], @building.files.to_a
47
- end
48
-
49
- def test_new
50
- assert FileModel.new
51
- end
52
-
53
- def test_association
54
- assert FileModel.new.person.nil?
55
- end
56
- end
@@ -1,2 +0,0 @@
1
- tmp/
2
- log/
@@ -1,7 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('config/application', __dir__)
5
- require 'rake'
6
-
7
- RailsApp::Application.load_tasks
File without changes
@@ -1,4 +0,0 @@
1
- class AddressesController < ApplicationController
2
- active_scaffold do
3
- end
4
- end
@@ -1,10 +0,0 @@
1
- # Filters added to this controller apply to all controllers in the application.
2
- # Likewise, all the methods added will be available for all controllers.
3
-
4
- class ApplicationController < ActionController::Base
5
- helper :all # include all helpers, all the time
6
- protect_from_forgery # See ActionController::RequestForgeryProtection for details
7
-
8
- # Scrub sensitive parameters from your log
9
- # filter_parameter_logging :password
10
- end
@@ -1,4 +0,0 @@
1
- class BuildingsController < ApplicationController
2
- active_scaffold do
3
- end
4
- end
@@ -1,5 +0,0 @@
1
- class CarsController < ApplicationController
2
- active_scaffold do
3
- columns[:model].inplace_edit = true
4
- end
5
- end
@@ -1,4 +0,0 @@
1
- class ContactsController < ApplicationController
2
- active_scaffold do
3
- end
4
- end
@@ -1,6 +0,0 @@
1
- class FloorsController < ApplicationController
2
- active_scaffold do |conf|
3
- conf.columns << :number_required
4
- conf.subform.columns << :number_required
5
- end
6
- end
@@ -1,8 +0,0 @@
1
- class PeopleController < ApplicationController
2
- active_scaffold do |conf|
3
- conf.columns.exclude :files
4
- conf.columns[:buildings].includes = nil
5
- conf.columns[:buildings].associated_limit = 0
6
- conf.create.columns.exclude :address
7
- end
8
- end
@@ -1,4 +0,0 @@
1
- class RolesController < ApplicationController
2
- active_scaffold do
3
- end
4
- end
@@ -1,3 +0,0 @@
1
- # Methods added to this helper will be available to all templates in the application.
2
- module ApplicationHelper
3
- end
@@ -1,3 +0,0 @@
1
- class Address < ActiveRecord::Base
2
- belongs_to :addressable, :polymorphic => true
3
- end
@@ -1,9 +0,0 @@
1
- class Building < ActiveRecord::Base
2
- belongs_to :owner, :class_name => 'Person', :counter_cache => true, :inverse_of => :buildings
3
- has_many :floors, :dependent => :destroy, :inverse_of => :building
4
-
5
- has_one :address, :as => :addressable
6
-
7
- has_many :tenants, :through => :floors, :class_name => 'Person'
8
- has_many :files, :through => :tenants, :class_name => 'FileModel'
9
- end
@@ -1,3 +0,0 @@
1
- class Car < ActiveRecord::Base
2
- belongs_to :person
3
- end
@@ -1,3 +0,0 @@
1
- class Contact < ActiveRecord::Base
2
- belongs_to :contactable, :polymorphic => true, :counter_cache => true
3
- end
@@ -1,31 +0,0 @@
1
- class FileModel < ActiveScaffold::Tableless
2
- column :name, :string
3
- column :person_id, :integer
4
- self.primary_key = :name
5
-
6
- belongs_to :person
7
-
8
- def self.find_all(relation)
9
- relation.conditions&.each&.with_index do |condition, i|
10
- person_id =
11
- case condition
12
- when Hash
13
- condition[:person_id]
14
- when Arel::Nodes::Equality
15
- if condition.left.name.to_sym == :person_id
16
- relation.bind_values[i].present? ? relation.bind_values[i][1] : condition.right.first
17
- end
18
- end
19
- return [new(person_id: person_id)] if person_id
20
- end
21
- []
22
- end
23
-
24
- def self.find_one(id, relation)
25
- nil
26
- end
27
-
28
- def destroy
29
- true
30
- end
31
- end
@@ -1,8 +0,0 @@
1
- class Floor < ActiveRecord::Base
2
- belongs_to :building, :counter_cache => true, :inverse_of => :floors
3
- belongs_to :tenant, :class_name => 'Person', :counter_cache => true, :inverse_of => :floor
4
- has_one :address, :through => :building
5
-
6
- attr_accessor :number_required
7
- validates :number, :presence => true, :if => :number_required
8
- end
@@ -1,12 +0,0 @@
1
- class Person < ActiveRecord::Base
2
- has_many :buildings, :foreign_key => :owner_id, :inverse_of => :owner
3
- has_one :floor, :foreign_key => :tenant_id, :inverse_of => :tenant
4
- has_one :address, :through => :floor
5
- has_one :home, :through => :floor, :source => :building, :class_name => 'Building'
6
-
7
- has_many :contacts, :as => :contactable
8
- has_one :car, :dependent => :destroy
9
- has_and_belongs_to_many :roles
10
-
11
- has_many :files, :dependent => :destroy, :class_name => 'FileModel'
12
- end
@@ -1,3 +0,0 @@
1
- class Role < ActiveRecord::Base
2
- has_and_belongs_to_many :people
3
- end
@@ -1,2 +0,0 @@
1
- <div id="app_form"></div>
2
- <%= render :super %>
@@ -1,2 +0,0 @@
1
- <div id="app"></div>
2
- <%= render :super %>
@@ -1,2 +0,0 @@
1
- <span id="first_name_field"></span>
2
- <%= form_attribute(column, record, scope, only_value, col_class) %>
@@ -1,2 +0,0 @@
1
- <div id="controller_form"></div>
2
- <%= render :super %>
@@ -1,2 +0,0 @@
1
- <div id="controller"></div>
2
- <%= render :super %>
@@ -1,14 +0,0 @@
1
- require File.expand_path('boot', __dir__)
2
-
3
- require 'rails/all'
4
- require 'rails/test_unit/railtie'
5
- require 'active_scaffold'
6
-
7
- module RailsApp
8
- class Application < Rails::Application
9
- config.filter_parameters << :password
10
- config.action_mailer.default_url_options = {:host => 'localhost:3000'}
11
- config.i18n.enforce_available_locales = false if config.i18n.respond_to? :enforce_available_locales
12
- config.active_record.sqlite3.represent_boolean_as_integer = true if config.active_record.sqlite3.respond_to? :represent_boolean_as_integer
13
- end
14
- end
@@ -1,7 +0,0 @@
1
- begin
2
- require File.expand_path('../../../.bundle/environment', __dir__)
3
- rescue LoadError
4
- require 'rubygems'
5
- require 'bundler'
6
- Bundler.setup :default, :test, :rails
7
- end
@@ -1,16 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
- development:
4
- adapter: sqlite3
5
- database: ":memory:"
6
- pool: 5
7
- timeout: 5000
8
-
9
- # Warning: The database defined as "test" will be erased and
10
- # re-generated from your development database when you run "rake".
11
- # Do not set this db to the same as development or production.
12
- test:
13
- adapter: sqlite3
14
- database: ":memory:"
15
- pool: 5
16
- timeout: 5000
@@ -1,6 +0,0 @@
1
- # Load the rails application
2
- require File.expand_path('application', __dir__)
3
-
4
- # Initialize the rails application
5
- RailsApp::Application.config.root = File.expand_path('..', __dir__)
6
- RailsApp::Application.initialize!
@@ -1,24 +0,0 @@
1
- RailsApp::Application.configure do
2
- # Settings specified here will take precedence over those in config/environment.rb
3
-
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the webserver when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
11
-
12
- # Show full error reports and disable caching
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send
17
- config.action_mailer.raise_delivery_errors = false
18
-
19
- # Print deprecation notices to the Rails logger
20
- config.active_support.deprecation = :log
21
-
22
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
24
- end
@@ -1,49 +0,0 @@
1
- RailsApp::Application.configure do
2
- # Settings specified here will take precedence over those in config/environment.rb
3
-
4
- # The production environment is meant for finished, "live" apps.
5
- # Code is not reloaded between requests
6
- config.cache_classes = true
7
-
8
- # Full error reports are disabled and caching is turned on
9
- config.consider_all_requests_local = false
10
- config.action_controller.perform_caching = true
11
-
12
- # Specifies the header that your server uses for sending files
13
- config.action_dispatch.x_sendfile_header = 'X-Sendfile'
14
-
15
- # For nginx:
16
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
-
18
- # If you have no front-end server that supports something like X-Sendfile,
19
- # just comment this out and Rails will serve the files
20
-
21
- # See everything in the log (default is :info)
22
- # config.log_level = :debug
23
-
24
- # Use a different logger for distributed setups
25
- # config.logger = SyslogLogger.new
26
-
27
- # Use a different cache store in production
28
- # config.cache_store = :mem_cache_store
29
-
30
- # Disable Rails's static asset server
31
- # In production, Apache or nginx will already do this
32
- config.serve_static_assets = false
33
-
34
- # Enable serving of images, stylesheets, and javascripts from an asset server
35
- # config.action_controller.asset_host = "http://assets.example.com"
36
-
37
- # Disable delivery errors, bad email addresses will be ignored
38
- # config.action_mailer.raise_delivery_errors = false
39
-
40
- # Enable threaded mode
41
- # config.threadsafe!
42
-
43
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
- # the I18n.default_locale when a translation can not be found)
45
- config.i18n.fallbacks = true
46
-
47
- # Send deprecation notices to registered listeners
48
- config.active_support.deprecation = :notify
49
- end
@@ -1,34 +0,0 @@
1
- RailsApp::Application.configure do
2
- # Settings specified here will take precedence over those in config/environment.rb
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = false
9
- config.eager_load = false
10
-
11
- # Show full error reports and disable caching
12
- config.consider_all_requests_local = true
13
- config.action_controller.perform_caching = false
14
-
15
- # Raise exceptions instead of rendering exception templates
16
- config.action_dispatch.show_exceptions = false
17
-
18
- # Disable request forgery protection in test environment
19
- config.action_controller.allow_forgery_protection = false
20
-
21
- # Tell Action Mailer not to deliver emails to the real world.
22
- # The :test delivery method accumulates sent emails in the
23
- # ActionMailer::Base.deliveries array.
24
- config.action_mailer.delivery_method = :test
25
-
26
- # Use SQL instead of Active Record's schema dumper when creating the test database.
27
- # This is necessary if your schema can't be completely dumped by the schema dumper,
28
- # like if you have constraints or database-specific column types
29
- # config.active_record.schema_format = :sql
30
-
31
- # Print deprecation notices to the stderr
32
- config.active_support.deprecation = :stderr
33
- config.active_support.test_order = :sorted
34
- end
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- Rails.backtrace_cleaner.remove_silencers!
@@ -1,10 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format
4
- # (all these examples are active by default):
5
- # ActiveSupport::Inflector.inflections do |inflect|
6
- # inflect.plural /^(ox)$/i, '\1en'
7
- # inflect.singular /^(ox)en/i, '\1'
8
- # inflect.irregular 'person', 'people'
9
- # inflect.uncountable %w( fish sheep )
10
- # end
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,11 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- if RailsApp::Application.config.respond_to? :secret_key_base
8
- RailsApp::Application.config.secret_key_base = 'e997edf9d7eba5cf89a76a046fa53f5d66261d22cfcf29e3f538c75ad2d175b106bd5d099f44f6ce34ad3b3162d71cfaa37d2d4f4b38645288331427b4c2a607'
9
- else
10
- RailsApp::Application.config.secret_token = 'e997edf9d7eba5cf89a76a046fa53f5d66261d22cfcf29e3f538c75ad2d175b106bd5d099f44f6ce34ad3b3162d71cfaa37d2d4f4b38645288331427b4c2a607'
11
- end
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- RailsApp::Application.config.session_store :cookie_store, :key => '_test_app_session'
4
-
5
- # Use the database for sessions instead of the cookie-based default,
6
- # which shouldn't be used to store highly confidential information
7
- # (create the session table with "rake db:sessions:create")
8
- # RailsApp::Application.config.session_store :active_record_store
@@ -1,14 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
- #
3
- # This file contains settings for ActionController::ParamsWrapper which
4
- # is enabled by default.
5
-
6
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters(:format => [:json])
9
- end
10
-
11
- # Disable root element in JSON by default.
12
- ActiveSupport.on_load(:active_record) do
13
- self.include_root_in_json = false
14
- end
@@ -1,5 +0,0 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
- en:
5
- hello: "Hello world"
@@ -1,17 +0,0 @@
1
- Rails.application.routes.draw do
2
- concern :active_scaffold, ActiveScaffold::Routing::Basic.new(association: true)
3
- concern :active_scaffold_association, ActiveScaffold::Routing::Association.new
4
-
5
- resources :addresses, concerns: :active_scaffold
6
- resources :buildings, except: :index do
7
- concerns :active_scaffold, except: %i[mark add_existing new_existing destroy_existing]
8
- end
9
- resources :cars, only: %i[index edit update] do
10
- concerns :active_scaffold, association: false, except: [:mark]
11
- end
12
- resources :people do
13
- concerns :active_scaffold, except: %i[mark]
14
- end
15
-
16
- match ':controller(/:action(/:id))', :via => :any
17
- end
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run TestApp::Application
@@ -1,68 +0,0 @@
1
- # rubocop:disable Metrics/BlockLength
2
- ActiveRecord::Schema.define do
3
- create_table 'addresses' do |t|
4
- t.integer 'addressable_id'
5
- t.string 'addressable_type'
6
- t.string 'street'
7
- t.string 'city'
8
- t.datetime 'created_at'
9
- t.datetime 'updated_at'
10
- end
11
-
12
- create_table 'buildings' do |t|
13
- t.string 'name'
14
- t.integer 'owner_id'
15
- t.integer 'floors_count', :null => false, :default => 0
16
- t.datetime 'created_at'
17
- t.datetime 'updated_at'
18
- end
19
-
20
- create_table 'cars' do |t|
21
- t.integer 'person_id'
22
- t.string 'brand'
23
- t.string 'model'
24
- t.datetime 'created_at'
25
- t.datetime 'updated_at'
26
- end
27
-
28
- create_table 'contacts' do |t|
29
- t.integer 'contactable_id'
30
- t.string 'contactable_type'
31
- t.string 'first_name'
32
- t.string 'last_name'
33
- t.date 'birthday'
34
- t.datetime 'created_at'
35
- t.datetime 'updated_at'
36
- end
37
-
38
- create_table 'floors' do |t|
39
- t.integer 'number'
40
- t.integer 'building_id'
41
- t.integer 'tenant_id'
42
- t.datetime 'created_at'
43
- t.datetime 'updated_at'
44
- end
45
-
46
- create_table 'people' do |t|
47
- t.string 'first_name'
48
- t.string 'last_name'
49
- t.integer 'buildings_count', :null => false, :default => 0
50
- t.integer 'floors_count', :null => false, :default => 0
51
- t.integer 'contacts_count', :null => false, :default => 0
52
- t.boolean 'adult', :null => false, :default => false
53
- t.datetime 'created_at'
54
- t.datetime 'updated_at'
55
- end
56
-
57
- create_table 'roles' do |t|
58
- t.string 'name'
59
- t.datetime 'created_at'
60
- t.datetime 'updated_at'
61
- end
62
-
63
- create_table 'people_roles', :id => false do |t|
64
- t.integer 'person_id'
65
- t.integer 'role_id'
66
- end
67
- end
68
- # rubocop:enable Metrics/BlockLength
@@ -1 +0,0 @@
1
- S
data/test/model_stub.rb DELETED
@@ -1,64 +0,0 @@
1
- class ModelStub < ActiveRecord::Base
2
- validates :b, :presence => true
3
- has_one :other_model, :class_name => 'ModelStub'
4
- has_many :other_models, :class_name => 'ModelStub'
5
-
6
- cattr_accessor :stubbed_columns
7
- self.stubbed_columns = %i[a b c d id created_at]
8
- attr_accessor(*stubbed_columns)
9
- self.primary_key = :id
10
-
11
- @@nested_scope_calls = []
12
- cattr_accessor :nested_scope_calls
13
-
14
- def self.a_is_defined
15
- @@nested_scope_calls << :a_is_defined
16
- self
17
- end
18
-
19
- def self.b_like(pattern)
20
- @@nested_scope_calls << :b_like
21
- self
22
- end
23
-
24
- attr_writer :other_model
25
- def other_model
26
- @other_model || nil
27
- end
28
-
29
- attr_writer :other_models
30
- def other_models
31
- @other_models || []
32
- end
33
-
34
- def self.columns
35
- @columns ||= stubbed_columns.map do |c|
36
- column = ColumnMock.new(c.to_s, '', 'varchar(255)')
37
- column.primary = true if c.to_s == primary_key.to_s && column.respond_to?(:primary=)
38
- column
39
- end
40
- end
41
-
42
- def self.columns_hash
43
- @columns_hash ||= columns.each_with_object({}) { |column, hash| hash[column.name.to_s] = column }
44
- end
45
-
46
- if respond_to? :type_for_attribute
47
- def self.type_for_attribute(attribute_name)
48
- defined?(ActiveModel::Type) ? ActiveModel::Type::String.new : super
49
- end
50
- end
51
-
52
- # column-level security methods, used for testing
53
- def self.a_authorized_for_bar?
54
- true
55
- end
56
-
57
- def self.b_authorized?
58
- false
59
- end
60
-
61
- def self.c_authorized_for_create?
62
- false
63
- end
64
- end