active_scaffold-sequel 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (318) hide show
  1. data/CHANGELOG +179 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README +36 -0
  4. data/app/assets/images/active_scaffold/add.gif +0 -0
  5. data/app/assets/images/active_scaffold/arrow_down.gif +0 -0
  6. data/app/assets/images/active_scaffold/arrow_up.gif +0 -0
  7. data/app/assets/images/active_scaffold/close.gif +0 -0
  8. data/app/assets/images/active_scaffold/close_touch.png +0 -0
  9. data/app/assets/images/active_scaffold/config.png +0 -0
  10. data/app/assets/images/active_scaffold/cross.png +0 -0
  11. data/app/assets/images/active_scaffold/gears.png +0 -0
  12. data/app/assets/images/active_scaffold/indicator-small.gif +0 -0
  13. data/app/assets/images/active_scaffold/indicator.gif +0 -0
  14. data/app/assets/images/active_scaffold/magnifier.png +0 -0
  15. data/app/assets/javascripts/active_scaffold.js.erb +19 -0
  16. data/app/assets/javascripts/jquery/active_scaffold.js +1057 -0
  17. data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +24 -0
  18. data/app/assets/javascripts/jquery/draggable_lists.js +27 -0
  19. data/app/assets/javascripts/jquery/jquery.editinplace.js +743 -0
  20. data/app/assets/javascripts/jquery/tiny_mce_bridge.js +7 -0
  21. data/app/assets/javascripts/prototype/active_scaffold.js +1052 -0
  22. data/app/assets/javascripts/prototype/dhtml_history.js +870 -0
  23. data/app/assets/javascripts/prototype/form_enhancements.js +117 -0
  24. data/app/assets/javascripts/prototype/rico_corner.js +370 -0
  25. data/app/assets/javascripts/prototype/tiny_mce_bridge.js +7 -0
  26. data/app/assets/stylesheets/active_scaffold-ie.css +35 -0
  27. data/app/assets/stylesheets/active_scaffold.css.scss +14 -0
  28. data/app/assets/stylesheets/active_scaffold_colors.css.scss +395 -0
  29. data/app/assets/stylesheets/active_scaffold_extensions.css.erb +2 -0
  30. data/app/assets/stylesheets/active_scaffold_images.css.scss +43 -0
  31. data/app/assets/stylesheets/active_scaffold_layout.css +912 -0
  32. data/app/assets/stylesheets/blue-theme.css +74 -0
  33. data/config/locales/de.yml +114 -0
  34. data/config/locales/en.yml +118 -0
  35. data/config/locales/es.yml +120 -0
  36. data/config/locales/fr.yml +121 -0
  37. data/config/locales/hu.yml +74 -0
  38. data/config/locales/ja.yml +73 -0
  39. data/config/locales/ru.yml +123 -0
  40. data/frontends/default/views/_action_group.html.erb +24 -0
  41. data/frontends/default/views/_add_existing_form.html.erb +30 -0
  42. data/frontends/default/views/_base_form.html.erb +51 -0
  43. data/frontends/default/views/_create_form.html.erb +8 -0
  44. data/frontends/default/views/_create_form_on_list.html.erb +6 -0
  45. data/frontends/default/views/_field_search.html.erb +32 -0
  46. data/frontends/default/views/_form.html.erb +24 -0
  47. data/frontends/default/views/_form_association.html.erb +15 -0
  48. data/frontends/default/views/_form_association_footer.html.erb +47 -0
  49. data/frontends/default/views/_form_attribute.html.erb +20 -0
  50. data/frontends/default/views/_form_hidden_attribute.html.erb +2 -0
  51. data/frontends/default/views/_form_messages.html.erb +5 -0
  52. data/frontends/default/views/_horizontal_subform.html.erb +28 -0
  53. data/frontends/default/views/_horizontal_subform_footer.html.erb +0 -0
  54. data/frontends/default/views/_horizontal_subform_header.html.erb +11 -0
  55. data/frontends/default/views/_horizontal_subform_record.html.erb +38 -0
  56. data/frontends/default/views/_human_conditions.html.erb +1 -0
  57. data/frontends/default/views/_list.html.erb +18 -0
  58. data/frontends/default/views/_list_actions.html.erb +15 -0
  59. data/frontends/default/views/_list_calculations.html.erb +16 -0
  60. data/frontends/default/views/_list_column_headings.html.erb +12 -0
  61. data/frontends/default/views/_list_header.html.erb +10 -0
  62. data/frontends/default/views/_list_inline_adapter.html.erb +10 -0
  63. data/frontends/default/views/_list_messages.html.erb +30 -0
  64. data/frontends/default/views/_list_pagination.html.erb +11 -0
  65. data/frontends/default/views/_list_pagination_links.html.erb +9 -0
  66. data/frontends/default/views/_list_record.html.erb +14 -0
  67. data/frontends/default/views/_list_record_columns.html.erb +8 -0
  68. data/frontends/default/views/_list_with_header.html.erb +36 -0
  69. data/frontends/default/views/_messages.html.erb +10 -0
  70. data/frontends/default/views/_render_field.js.erb +20 -0
  71. data/frontends/default/views/_row.html.erb +6 -0
  72. data/frontends/default/views/_search.html.erb +34 -0
  73. data/frontends/default/views/_search_attribute.html.erb +10 -0
  74. data/frontends/default/views/_show.html.erb +8 -0
  75. data/frontends/default/views/_show_columns.html.erb +15 -0
  76. data/frontends/default/views/_update_actions.html.erb +9 -0
  77. data/frontends/default/views/_update_form.html.erb +6 -0
  78. data/frontends/default/views/_vertical_subform.html.erb +12 -0
  79. data/frontends/default/views/_vertical_subform_record.html.erb +38 -0
  80. data/frontends/default/views/action_confirmation.html.erb +13 -0
  81. data/frontends/default/views/add_existing.js.erb +18 -0
  82. data/frontends/default/views/add_existing_form.html.erb +5 -0
  83. data/frontends/default/views/create.html.erb +5 -0
  84. data/frontends/default/views/delete.html.erb +13 -0
  85. data/frontends/default/views/destroy.js.erb +24 -0
  86. data/frontends/default/views/edit_associated.js.erb +12 -0
  87. data/frontends/default/views/field_search.html.erb +5 -0
  88. data/frontends/default/views/form_messages.js.erb +1 -0
  89. data/frontends/default/views/list.html.erb +1 -0
  90. data/frontends/default/views/on_action_update.js.erb +13 -0
  91. data/frontends/default/views/on_create.js.erb +47 -0
  92. data/frontends/default/views/on_mark_all.js.erb +12 -0
  93. data/frontends/default/views/on_update.js.erb +31 -0
  94. data/frontends/default/views/refresh_list.js.erb +1 -0
  95. data/frontends/default/views/render_field.js.erb +1 -0
  96. data/frontends/default/views/search.html.erb +5 -0
  97. data/frontends/default/views/show.html.erb +5 -0
  98. data/frontends/default/views/update.html.erb +8 -0
  99. data/frontends/default/views/update_column.js.erb +16 -0
  100. data/frontends/default/views/update_row.js.erb +1 -0
  101. data/lib/active_scaffold/actions/common_search.rb +25 -0
  102. data/lib/active_scaffold/actions/core.rb +197 -0
  103. data/lib/active_scaffold/actions/create.rb +148 -0
  104. data/lib/active_scaffold/actions/delete.rb +76 -0
  105. data/lib/active_scaffold/actions/field_search.rb +82 -0
  106. data/lib/active_scaffold/actions/list.rb +196 -0
  107. data/lib/active_scaffold/actions/mark.rb +75 -0
  108. data/lib/active_scaffold/actions/nested.rb +245 -0
  109. data/lib/active_scaffold/actions/search.rb +48 -0
  110. data/lib/active_scaffold/actions/show.rb +61 -0
  111. data/lib/active_scaffold/actions/subform.rb +23 -0
  112. data/lib/active_scaffold/actions/update.rb +150 -0
  113. data/lib/active_scaffold/active_record_permissions.rb +136 -0
  114. data/lib/active_scaffold/attribute_params.rb +208 -0
  115. data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +39 -0
  116. data/lib/active_scaffold/bridges/ancestry.rb +5 -0
  117. data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +67 -0
  118. data/lib/active_scaffold/bridges/calendar_date_select.rb +24 -0
  119. data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +107 -0
  120. data/lib/active_scaffold/bridges/cancan.rb +15 -0
  121. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +31 -0
  122. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge_helpers.rb +10 -0
  123. data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +45 -0
  124. data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +17 -0
  125. data/lib/active_scaffold/bridges/carrierwave.rb +12 -0
  126. data/lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb +358 -0
  127. data/lib/active_scaffold/bridges/country_helper.rb +9 -0
  128. data/lib/active_scaffold/bridges/date_picker/ext.rb +45 -0
  129. data/lib/active_scaffold/bridges/date_picker/helper.rb +180 -0
  130. data/lib/active_scaffold/bridges/date_picker.rb +23 -0
  131. data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +34 -0
  132. data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge_helpers.rb +10 -0
  133. data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +27 -0
  134. data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +16 -0
  135. data/lib/active_scaffold/bridges/dragonfly.rb +9 -0
  136. data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +48 -0
  137. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +57 -0
  138. data/lib/active_scaffold/bridges/file_column/form_ui.rb +34 -0
  139. data/lib/active_scaffold/bridges/file_column/list_ui.rb +26 -0
  140. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +43 -0
  141. data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +9 -0
  142. data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +15 -0
  143. data/lib/active_scaffold/bridges/file_column.rb +11 -0
  144. data/lib/active_scaffold/bridges/paperclip/form_ui.rb +27 -0
  145. data/lib/active_scaffold/bridges/paperclip/list_ui.rb +16 -0
  146. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +36 -0
  147. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +24 -0
  148. data/lib/active_scaffold/bridges/paperclip.rb +12 -0
  149. data/lib/active_scaffold/bridges/record_select/helpers.rb +86 -0
  150. data/lib/active_scaffold/bridges/record_select.rb +11 -0
  151. data/lib/active_scaffold/bridges/semantic_attributes/column.rb +20 -0
  152. data/lib/active_scaffold/bridges/semantic_attributes.rb +5 -0
  153. data/lib/active_scaffold/bridges/shared/date_bridge.rb +209 -0
  154. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +46 -0
  155. data/lib/active_scaffold/bridges/tiny_mce.rb +17 -0
  156. data/lib/active_scaffold/bridges.rb +61 -0
  157. data/lib/active_scaffold/config/base.rb +71 -0
  158. data/lib/active_scaffold/config/core.rb +219 -0
  159. data/lib/active_scaffold/config/create.rb +44 -0
  160. data/lib/active_scaffold/config/delete.rb +33 -0
  161. data/lib/active_scaffold/config/field_search.rb +76 -0
  162. data/lib/active_scaffold/config/form.rb +48 -0
  163. data/lib/active_scaffold/config/list.rb +196 -0
  164. data/lib/active_scaffold/config/mark.rb +35 -0
  165. data/lib/active_scaffold/config/nested.rb +42 -0
  166. data/lib/active_scaffold/config/search.rb +73 -0
  167. data/lib/active_scaffold/config/show.rb +32 -0
  168. data/lib/active_scaffold/config/subform.rb +35 -0
  169. data/lib/active_scaffold/config/update.rb +41 -0
  170. data/lib/active_scaffold/configurable.rb +29 -0
  171. data/lib/active_scaffold/constraints.rb +170 -0
  172. data/lib/active_scaffold/data_structures/action_columns.rb +140 -0
  173. data/lib/active_scaffold/data_structures/action_link.rb +179 -0
  174. data/lib/active_scaffold/data_structures/action_links.rb +185 -0
  175. data/lib/active_scaffold/data_structures/actions.rb +45 -0
  176. data/lib/active_scaffold/data_structures/bridge.rb +22 -0
  177. data/lib/active_scaffold/data_structures/column.rb +389 -0
  178. data/lib/active_scaffold/data_structures/columns.rb +75 -0
  179. data/lib/active_scaffold/data_structures/error_message.rb +24 -0
  180. data/lib/active_scaffold/data_structures/nested_info.rb +130 -0
  181. data/lib/active_scaffold/data_structures/set.rb +57 -0
  182. data/lib/active_scaffold/data_structures/sorting.rb +172 -0
  183. data/lib/active_scaffold/engine.rb +4 -0
  184. data/lib/active_scaffold/extensions/action_controller_rendering.rb +22 -0
  185. data/lib/active_scaffold/extensions/action_view_rendering.rb +115 -0
  186. data/lib/active_scaffold/extensions/active_record_offset.rb +12 -0
  187. data/lib/active_scaffold/extensions/array.rb +7 -0
  188. data/lib/active_scaffold/extensions/cache_association.rb +16 -0
  189. data/lib/active_scaffold/extensions/localize.rb +10 -0
  190. data/lib/active_scaffold/extensions/name_option_for_datetime.rb +12 -0
  191. data/lib/active_scaffold/extensions/nil_id_in_url_params.rb +7 -0
  192. data/lib/active_scaffold/extensions/paginator_extensions.rb +26 -0
  193. data/lib/active_scaffold/extensions/routing_mapper.rb +48 -0
  194. data/lib/active_scaffold/extensions/to_label.rb +8 -0
  195. data/lib/active_scaffold/extensions/unsaved_associated.rb +60 -0
  196. data/lib/active_scaffold/extensions/unsaved_record.rb +20 -0
  197. data/lib/active_scaffold/extensions/usa_state.rb +46 -0
  198. data/lib/active_scaffold/finder.rb +372 -0
  199. data/lib/active_scaffold/helpers/association_helpers.rb +48 -0
  200. data/lib/active_scaffold/helpers/controller_helpers.rb +88 -0
  201. data/lib/active_scaffold/helpers/form_column_helpers.rb +321 -0
  202. data/lib/active_scaffold/helpers/human_condition_helpers.rb +62 -0
  203. data/lib/active_scaffold/helpers/id_helpers.rb +127 -0
  204. data/lib/active_scaffold/helpers/list_column_helpers.rb +340 -0
  205. data/lib/active_scaffold/helpers/pagination_helpers.rb +55 -0
  206. data/lib/active_scaffold/helpers/search_column_helpers.rb +267 -0
  207. data/lib/active_scaffold/helpers/show_column_helpers.rb +50 -0
  208. data/lib/active_scaffold/helpers/view_helpers.rb +342 -0
  209. data/lib/active_scaffold/marked_model.rb +38 -0
  210. data/lib/active_scaffold/paginator.rb +136 -0
  211. data/lib/active_scaffold/responds_to_parent.rb +70 -0
  212. data/lib/active_scaffold/version.rb +9 -0
  213. data/lib/active_scaffold.rb +368 -0
  214. data/lib/active_scaffold_env.rb +11 -0
  215. data/lib/generators/active_scaffold/USAGE +29 -0
  216. data/lib/generators/active_scaffold/active_scaffold_generator.rb +20 -0
  217. data/lib/generators/active_scaffold_controller/USAGE +19 -0
  218. data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +29 -0
  219. data/lib/generators/active_scaffold_controller/templates/controller.rb +4 -0
  220. data/lib/generators/active_scaffold_controller/templates/helper.rb +2 -0
  221. data/public/blank.html +33 -0
  222. data/shoulda_macros/macros.rb +136 -0
  223. data/test/bridges/active_scaffold_dependent_protect_test.rb +34 -0
  224. data/test/bridges/bridge_test.rb +90 -0
  225. data/test/bridges/company.rb +81 -0
  226. data/test/bridges/paperclip_test.rb +68 -0
  227. data/test/bridges/tiny_mce_test.rb +27 -0
  228. data/test/bridges/unobtrusive_date_picker_test.rb +49 -0
  229. data/test/bridges/validation_reflection_test.rb +57 -0
  230. data/test/config/base_test.rb +15 -0
  231. data/test/config/core_test.rb +58 -0
  232. data/test/config/create_test.rb +58 -0
  233. data/test/config/delete_test.rb +33 -0
  234. data/test/config/field_search_test.rb +47 -0
  235. data/test/config/list_test.rb +129 -0
  236. data/test/config/nested_test.rb +62 -0
  237. data/test/config/search_test.rb +60 -0
  238. data/test/config/show_test.rb +43 -0
  239. data/test/config/subform_test.rb +17 -0
  240. data/test/config/update_test.rb +40 -0
  241. data/test/const_mocker.rb +36 -0
  242. data/test/data_structures/action_columns_test.rb +113 -0
  243. data/test/data_structures/action_link_test.rb +78 -0
  244. data/test/data_structures/action_links_test.rb +78 -0
  245. data/test/data_structures/actions_test.rb +25 -0
  246. data/test/data_structures/association_column_test.rb +42 -0
  247. data/test/data_structures/column_test.rb +185 -0
  248. data/test/data_structures/columns_test.rb +69 -0
  249. data/test/data_structures/error_message_test.rb +28 -0
  250. data/test/data_structures/set_test.rb +86 -0
  251. data/test/data_structures/sorting_test.rb +126 -0
  252. data/test/data_structures/standard_column_test.rb +24 -0
  253. data/test/data_structures/virtual_column_test.rb +23 -0
  254. data/test/extensions/active_record_test.rb +45 -0
  255. data/test/extensions/array_test.rb +12 -0
  256. data/test/helpers/form_column_helpers_test.rb +31 -0
  257. data/test/helpers/list_column_helpers_test.rb +42 -0
  258. data/test/helpers/pagination_helpers_test.rb +59 -0
  259. data/test/misc/active_record_permissions_test.rb +154 -0
  260. data/test/misc/attribute_params_test.rb +146 -0
  261. data/test/misc/configurable_test.rb +96 -0
  262. data/test/misc/constraints_test.rb +193 -0
  263. data/test/misc/finder_test.rb +92 -0
  264. data/test/misc/lang_test.rb +11 -0
  265. data/test/mock_app/app/controllers/application_controller.rb +10 -0
  266. data/test/mock_app/app/helpers/application_helper.rb +3 -0
  267. data/test/mock_app/config/boot.rb +110 -0
  268. data/test/mock_app/config/database.yml +16 -0
  269. data/test/mock_app/config/environment.rb +43 -0
  270. data/test/mock_app/config/environments/development.rb +17 -0
  271. data/test/mock_app/config/environments/production.rb +28 -0
  272. data/test/mock_app/config/environments/test.rb +28 -0
  273. data/test/mock_app/config/initializers/backtrace_silencers.rb +7 -0
  274. data/test/mock_app/config/initializers/inflections.rb +10 -0
  275. data/test/mock_app/config/initializers/mime_types.rb +5 -0
  276. data/test/mock_app/config/initializers/new_rails_defaults.rb +19 -0
  277. data/test/mock_app/config/initializers/session_store.rb +15 -0
  278. data/test/mock_app/config/locales/en.yml +5 -0
  279. data/test/mock_app/config/routes.rb +43 -0
  280. data/test/mock_app/db/test.sqlite3 +1 -0
  281. data/test/mock_app/public/blank.html +33 -0
  282. data/test/mock_app/public/images/active_scaffold/DO_NOT_EDIT +2 -0
  283. data/test/mock_app/public/images/active_scaffold/default/add.gif +0 -0
  284. data/test/mock_app/public/images/active_scaffold/default/arrow_down.gif +0 -0
  285. data/test/mock_app/public/images/active_scaffold/default/arrow_up.gif +0 -0
  286. data/test/mock_app/public/images/active_scaffold/default/close.gif +0 -0
  287. data/test/mock_app/public/images/active_scaffold/default/cross.png +0 -0
  288. data/test/mock_app/public/images/active_scaffold/default/indicator-small.gif +0 -0
  289. data/test/mock_app/public/images/active_scaffold/default/indicator.gif +0 -0
  290. data/test/mock_app/public/images/active_scaffold/default/magnifier.png +0 -0
  291. data/test/mock_app/public/javascripts/active_scaffold/DO_NOT_EDIT +2 -0
  292. data/test/mock_app/public/javascripts/active_scaffold/default/active_scaffold.js +532 -0
  293. data/test/mock_app/public/javascripts/active_scaffold/default/dhtml_history.js +867 -0
  294. data/test/mock_app/public/javascripts/active_scaffold/default/form_enhancements.js +117 -0
  295. data/test/mock_app/public/javascripts/active_scaffold/default/rico_corner.js +370 -0
  296. data/test/mock_app/public/stylesheets/active_scaffold/DO_NOT_EDIT +2 -0
  297. data/test/mock_app/public/stylesheets/active_scaffold/default/stylesheet-ie.css +35 -0
  298. data/test/mock_app/public/stylesheets/active_scaffold/default/stylesheet.css +848 -0
  299. data/test/model_stub.rb +55 -0
  300. data/test/run_all.rb +8 -0
  301. data/test/test_helper.rb +39 -0
  302. data/vendor/assets/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  303. data/vendor/assets/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  304. data/vendor/assets/images/ui-bg_flat_10_000000_40x100.png +0 -0
  305. data/vendor/assets/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  306. data/vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  307. data/vendor/assets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  308. data/vendor/assets/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  309. data/vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  310. data/vendor/assets/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  311. data/vendor/assets/images/ui-icons_222222_256x240.png +0 -0
  312. data/vendor/assets/images/ui-icons_228ef1_256x240.png +0 -0
  313. data/vendor/assets/images/ui-icons_ef8c08_256x240.png +0 -0
  314. data/vendor/assets/images/ui-icons_ffd27a_256x240.png +0 -0
  315. data/vendor/assets/images/ui-icons_ffffff_256x240.png +0 -0
  316. data/vendor/assets/javascripts/jquery-ui-timepicker-addon.js +1276 -0
  317. data/vendor/assets/stylesheets/jquery-ui.css +568 -0
  318. metadata +502 -0
@@ -0,0 +1,193 @@
1
+ require File.join(File.dirname(__FILE__), '../test_helper.rb')
2
+
3
+ module ModelStubs
4
+ class ModelStub < ActiveRecord::Base
5
+ abstract_class = true
6
+ def self.columns; [ActiveRecord::ConnectionAdapters::Column.new('foo', '')] end
7
+ def self.table_name
8
+ to_s.split('::').last.underscore.pluralize
9
+ end
10
+ self.store_full_sti_class = false
11
+ end
12
+
13
+ ##
14
+ ## Standard associations
15
+ ##
16
+
17
+ class Address < ModelStub
18
+ belongs_to :addressable, :polymorphic => true
19
+ end
20
+
21
+ class User < ModelStub
22
+ has_and_belongs_to_many :roles
23
+ has_one :subscription
24
+ has_one :address, :as => :addressable
25
+ end
26
+
27
+ class Service < ModelStub
28
+ has_many :subscriptions
29
+ has_many :users, :through => :subscriptions
30
+ end
31
+
32
+ class Subscription < ModelStub
33
+ belongs_to :service
34
+ belongs_to :user
35
+ end
36
+
37
+ class Role < ModelStub
38
+ has_and_belongs_to_many :users
39
+ end
40
+
41
+ ##
42
+ ## These versions of the associations require extra configuration to work properly
43
+ ##
44
+
45
+ class OtherAddress < ModelStub
46
+ set_table_name 'addresses'
47
+ belongs_to :other_addressable, :polymorphic => true
48
+ end
49
+
50
+ class OtherUser < ModelStub
51
+ set_table_name 'users'
52
+ has_and_belongs_to_many :other_roles, :class_name => 'ModelStubs::OtherRole', :foreign_key => 'user_id', :association_foreign_key => 'role_id', :join_table => 'roles_users'
53
+ has_one :other_subscription, :class_name => 'ModelStubs::OtherSubscription', :foreign_key => 'user_id'
54
+ has_one :other_address, :as => :other_addressable, :class_name => 'ModelStubs::OtherAddress', :foreign_key => 'addressable_id'
55
+ end
56
+
57
+ class OtherService < ModelStub
58
+ set_table_name 'services'
59
+ has_many :other_subscriptions, :class_name => 'ModelStubs::OtherSubscription', :foreign_key => 'service_id'
60
+ has_many :other_users, :through => :other_subscriptions # :class_name and :foreign_key are ignored for :through
61
+ end
62
+
63
+ class OtherSubscription < ModelStub
64
+ set_table_name 'subscriptions'
65
+ belongs_to :other_service, :class_name => 'ModelStubs::OtherService', :foreign_key => 'service_id'
66
+ belongs_to :other_user, :class_name => 'ModelStubs::OtherUser', :foreign_key => 'user_id'
67
+ end
68
+
69
+ class OtherRole < ModelStub
70
+ set_table_name 'roles'
71
+ has_and_belongs_to_many :other_users, :class_name => 'ModelStubs::OtherUser', :foreign_key => 'role_id', :association_foreign_key => 'user_id', :join_table => 'roles_users'
72
+ end
73
+
74
+ class PrimaryKeyUser < ModelStub
75
+ has_many :locations, :class_name => 'PrimaryKeyLocation', :foreign_key => :username, :primary_key => :name
76
+ end
77
+
78
+ class PrimaryKeyLocation < ModelStub
79
+ belongs_to :user, :class_name => 'PrimaryKeyUser', :foreign_key => :username, :primary_key => :name
80
+ end
81
+ end
82
+
83
+ class ConstraintsTestObject
84
+ # stub out what the mixin expects to find ...
85
+ def self.before_filter(*args); end
86
+ attr_accessor :active_scaffold_includes
87
+ attr_accessor :active_scaffold_habtm_joins
88
+ attr_accessor :active_scaffold_config
89
+ attr_accessor :params
90
+ def merge_conditions(old, new)
91
+ [old, new].compact.flatten
92
+ end
93
+
94
+ # mixin the constraint code
95
+ include ActiveScaffold::Constraints
96
+
97
+ # make the constraints read-write, instead of coming from the session
98
+ attr_accessor :active_scaffold_constraints
99
+
100
+ def initialize
101
+ @active_scaffold_includes = []
102
+ @active_scaffold_habtm_joins = []
103
+ @params = {}
104
+ end
105
+ end
106
+
107
+ class ConstraintsTest < Test::Unit::TestCase
108
+ def setup
109
+ @test_object = ConstraintsTestObject.new
110
+ end
111
+
112
+ def test_constraint_conditions_for_default_associations
113
+ @test_object.active_scaffold_config = config_for('user')
114
+ # has_one (vs belongs_to)
115
+ assert_constraint_condition({:subscription => 5}, ['subscriptions.id = ?', 5], 'find the user with subscription #5')
116
+ # habtm (vs habtm)
117
+ assert_constraint_condition({:roles => 4}, ['roles_users.role_id = ?', 4], 'find all users with role #4')
118
+ # has_one (vs polymorphic)
119
+ assert_constraint_condition({:address => 11}, ['addresses.id = ?', 11], 'find the user with address #11')
120
+ # reverse of a has_many :through
121
+ assert_constraint_condition({:subscription => {:service => 5}}, ['services.id = ?', 5], 'find all users subscribed to service #5')
122
+ assert(@test_object.active_scaffold_includes.include?({:subscription => :service}), 'multi-level association include')
123
+
124
+ @test_object.active_scaffold_config = config_for('subscription')
125
+ # belongs_to (vs has_one)
126
+ assert_constraint_condition({:user => 2}, ['subscriptions.user_id = ?', 2], 'find the subscription for user #2')
127
+ # belongs_to (vs has_many)
128
+ assert_constraint_condition({:service => 1}, ['subscriptions.service_id = ?', 1], 'find all subscriptions for service #1')
129
+
130
+ @test_object.active_scaffold_config = config_for('service')
131
+ # has_many (vs belongs_to)
132
+ assert_constraint_condition({:subscriptions => 10}, ['subscriptions.id = ?', 10], 'find the service with subscription #10')
133
+ # has_many :through (through has_many)
134
+ assert_constraint_condition({:users => 7}, ['users.id = ?', 7], 'find the service with user #7')
135
+
136
+ @test_object.active_scaffold_config = config_for('address')
137
+ # belongs_to :polymorphic => true
138
+ @test_object.params[:parent_model] = 'User'
139
+ assert_constraint_condition({:addressable => 14}, ['addresses.addressable_id = ?', 14, 'addresses.addressable_type = ?', 'User'], 'find all addresses for user #14')
140
+ end
141
+
142
+ def test_constraint_conditions_for_configured_associations
143
+ @test_object.active_scaffold_config = config_for('other_user')
144
+ # has_one (vs belongs_to)
145
+ assert_constraint_condition({:other_subscription => 5}, ['subscriptions.id = ?', 5], 'find the user with subscription #5')
146
+ # habtm (vs habtm)
147
+ assert_constraint_condition({:other_roles => 4}, ['roles_users.role_id = ?', 4], 'find all users with role #4')
148
+ # has_one (vs polymorphic)
149
+ assert_constraint_condition({:other_address => 11}, ['addresses.id = ?', 11], 'find the user with address #11')
150
+ # reverse of a has_many :through
151
+ assert_constraint_condition({:other_subscription => {:other_service => 5}}, ['services.id = ?', 5], 'find all users subscribed to service #5')
152
+
153
+ @test_object.active_scaffold_config = config_for('other_subscription')
154
+ # belongs_to (vs has_one)
155
+ assert_constraint_condition({:other_user => 2}, ['subscriptions.user_id = ?', 2], 'find the subscription for user #2')
156
+ # belongs_to (vs has_many)
157
+ assert_constraint_condition({:other_service => 1}, ['subscriptions.service_id = ?', 1], 'find all subscriptions for service #1')
158
+
159
+ @test_object.active_scaffold_config = config_for('other_service')
160
+ # has_many (vs belongs_to)
161
+ assert_constraint_condition({:other_subscriptions => 10}, ['subscriptions.id = ?', 10], 'find the service with subscription #10')
162
+ # has_many :through (through has_many)
163
+ assert_constraint_condition({:other_users => 7}, ['users.id = ?', 7], 'find the service with user #7')
164
+
165
+ @test_object.active_scaffold_config = config_for('other_address')
166
+ # belongs_to :polymorphic => true
167
+ @test_object.params[:parent_model] = 'OtherUser'
168
+ assert_constraint_condition({:other_addressable => 14}, ['addresses.other_addressable_id = ?', 14, 'addresses.other_addressable_type = ?', 'OtherUser'], 'find all addresses for user #14')
169
+ end
170
+
171
+ def test_constraint_conditions_for_normal_attributes
172
+ @test_object.active_scaffold_config = config_for('user')
173
+ assert_constraint_condition({'foo' => 'bar'}, ['"users"."foo" = ?', 'bar'], 'normal column-based constraint')
174
+ end
175
+
176
+ def test_constraint_conditions_for_associations_with_primary_key_option
177
+ @test_object.active_scaffold_config = config_for('primary_key_location')
178
+ #user = ModelStubs::PrimaryKeyUser.new(:id => 1, :name => 'User Name')
179
+ ModelStubs::PrimaryKeyUser.expects(:find).with(1).returns(stub(:id => 1, :name => 'User Name'))
180
+ assert_constraint_condition({'user' => 1}, ['primary_key_locations.username = ?', 'User Name'], 'association with primary-key constraint')
181
+ end
182
+
183
+ protected
184
+
185
+ def assert_constraint_condition(constraint, condition, message = nil)
186
+ @test_object.active_scaffold_constraints = constraint
187
+ assert_equal condition, @test_object.send(:conditions_from_constraints), message
188
+ end
189
+
190
+ def config_for(klass, namespace = nil)
191
+ super(klass, "model_stubs/")
192
+ end
193
+ end
@@ -0,0 +1,92 @@
1
+ require File.join(File.dirname(__FILE__), '../test_helper.rb')
2
+ # require 'test/model_stub'
3
+
4
+ class ClassWithFinder
5
+ include ActiveScaffold::Finder
6
+ def conditions_for_collection; end
7
+ def conditions_from_params; end
8
+ def conditions_from_constraints; end
9
+ def joins_for_collection; end
10
+ def custom_finder_options
11
+ {}
12
+ end
13
+ def beginning_of_chain
14
+ active_scaffold_config.model
15
+ end
16
+ end
17
+
18
+ class FinderTest < Test::Unit::TestCase
19
+ def setup
20
+ @klass = ClassWithFinder.new
21
+ @klass.stubs(:active_scaffold_config).returns(mock { stubs(:model).returns(ModelStub) })
22
+ @klass.stubs(:active_scaffold_session_storage).returns({})
23
+ end
24
+
25
+ def test_create_conditions_for_columns
26
+ columns = [
27
+ ActiveScaffold::DataStructures::Column.new(:a, ModelStub),
28
+ ActiveScaffold::DataStructures::Column.new(:b, ModelStub)
29
+ ]
30
+ tokens = [
31
+ 'foo',
32
+ 'bar'
33
+ ]
34
+
35
+ expected_conditions = [
36
+ '("model_stubs"."a" LIKE ? OR "model_stubs"."b" LIKE ?) AND ("model_stubs"."a" LIKE ? OR "model_stubs"."b" LIKE ?)',
37
+ '%foo%', '%foo%', '%bar%', '%bar%'
38
+ ]
39
+ assert_equal expected_conditions, ClassWithFinder.create_conditions_for_columns(tokens, columns)
40
+
41
+ expected_conditions = [
42
+ '("model_stubs"."a" LIKE ? OR "model_stubs"."b" LIKE ?)',
43
+ '%foo%', '%foo%'
44
+ ]
45
+ assert_equal expected_conditions, ClassWithFinder.create_conditions_for_columns('foo', columns)
46
+
47
+ assert_equal nil, ClassWithFinder.create_conditions_for_columns('foo', [])
48
+ end
49
+
50
+ def test_method_sorting
51
+ column = ActiveScaffold::DataStructures::Column.new('a', ModelStub)
52
+ column.sort_by :method => proc{self}
53
+
54
+ collection = [16000, 2853, 98765, 6188, 4]
55
+ assert_equal collection.sort, @klass.send(:sort_collection_by_column, collection, column, 'asc')
56
+ assert_equal collection.sort.reverse, @klass.send(:sort_collection_by_column, collection, column, 'desc')
57
+
58
+ collection = ['a', nil, 'b']
59
+ result = nil
60
+ assert_nothing_raised do
61
+ result = @klass.send(:sort_collection_by_column, collection, column, 'asc')
62
+ end
63
+ assert_equal [nil, 'a', 'b'], result
64
+
65
+ column.sort_by :method => 'self'
66
+ collection = [3, 1, 2]
67
+ assert_equal collection.sort, @klass.send(:sort_collection_by_column, collection, column, 'asc')
68
+ end
69
+
70
+ def test_count_with_group
71
+ @klass.expects(:custom_finder_options).returns({:group => :a})
72
+ ModelStub.expects(:count).returns(ActiveSupport::OrderedHash['foo', 5])
73
+ ModelStub.expects(:find).with(:all, has_entries(:limit => 20, :offset => 0))
74
+ page = @klass.send :find_page, :per_page => 20, :pagination => true
75
+ page.items
76
+
77
+ assert_kind_of Integer, page.pager.count
78
+ assert_equal 1, page.pager.count
79
+ assert_nothing_raised { page.pager.number_of_pages }
80
+ end
81
+
82
+ def test_disabled_pagination
83
+ ModelStub.expects(:find).with(:all, Not(has_entries(:limit => 20, :offset => 0)))
84
+ page = @klass.send :find_page, :per_page => 20, :pagination => false
85
+ page.items
86
+ end
87
+
88
+ def test_infinite_pagination
89
+ ModelStub.expects(:count).never
90
+ page = @klass.send :find_page, :pagination => :infinite
91
+ end
92
+ end
@@ -0,0 +1,11 @@
1
+ require File.join(File.dirname(__FILE__), '../test_helper.rb')
2
+
3
+ class LocalizationTest < Test::Unit::TestCase
4
+
5
+ def test_localization
6
+ assert_equal "Dutch", as_(:dutch)
7
+ assert_equal "dutch", as_('dutch')
8
+ I18n.backend.store_translations :en, :active_scaffold => {:create_model => 'Create %{model}'}
9
+ assert_equal "Create Test", as_(:create_model, :model => 'Test')
10
+ end
11
+ end
@@ -0,0 +1,10 @@
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
@@ -0,0 +1,3 @@
1
+ # Methods added to this helper will be available to all templates in the application.
2
+ module ApplicationHelper
3
+ end
@@ -0,0 +1,110 @@
1
+ # Don't change this file!
2
+ # Configure your app in config/environment.rb and config/environments/*.rb
3
+
4
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
5
+
6
+ module Rails
7
+ class << self
8
+ def boot!
9
+ unless booted?
10
+ preinitialize
11
+ pick_boot.run
12
+ end
13
+ end
14
+
15
+ def booted?
16
+ defined? Rails::Initializer
17
+ end
18
+
19
+ def pick_boot
20
+ (vendor_rails? ? VendorBoot : GemBoot).new
21
+ end
22
+
23
+ def vendor_rails?
24
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
25
+ end
26
+
27
+ def preinitialize
28
+ load(preinitializer_path) if File.exist?(preinitializer_path)
29
+ end
30
+
31
+ def preinitializer_path
32
+ "#{RAILS_ROOT}/config/preinitializer.rb"
33
+ end
34
+ end
35
+
36
+ class Boot
37
+ def run
38
+ load_initializer
39
+ Rails::Initializer.run(:set_load_path)
40
+ end
41
+ end
42
+
43
+ class VendorBoot < Boot
44
+ def load_initializer
45
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46
+ Rails::Initializer.run(:install_gem_spec_stubs)
47
+ Rails::GemDependency.add_frozen_gem_path
48
+ end
49
+ end
50
+
51
+ class GemBoot < Boot
52
+ def load_initializer
53
+ self.class.load_rubygems
54
+ load_rails_gem
55
+ require 'initializer'
56
+ end
57
+
58
+ def load_rails_gem
59
+ if version = self.class.gem_version
60
+ gem 'rails', version
61
+ else
62
+ gem 'rails'
63
+ end
64
+ rescue Gem::LoadError => load_error
65
+ $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
66
+ exit 1
67
+ end
68
+
69
+ class << self
70
+ def rubygems_version
71
+ Gem::RubyGemsVersion rescue nil
72
+ end
73
+
74
+ def gem_version
75
+ if defined? RAILS_GEM_VERSION
76
+ RAILS_GEM_VERSION
77
+ elsif ENV.include?('RAILS_GEM_VERSION')
78
+ ENV['RAILS_GEM_VERSION']
79
+ else
80
+ parse_gem_version(read_environment_rb)
81
+ end
82
+ end
83
+
84
+ def load_rubygems
85
+ require 'rubygems'
86
+ min_version = '1.3.1'
87
+ unless rubygems_version >= min_version
88
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
89
+ exit 1
90
+ end
91
+
92
+ rescue LoadError
93
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
94
+ exit 1
95
+ end
96
+
97
+ def parse_gem_version(text)
98
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
99
+ end
100
+
101
+ private
102
+ def read_environment_rb
103
+ File.read("#{RAILS_ROOT}/config/environment.rb")
104
+ end
105
+ end
106
+ end
107
+ end
108
+
109
+ # All that for this:
110
+ Rails.boot!
@@ -0,0 +1,16 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
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: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
@@ -0,0 +1,43 @@
1
+ # Be sure to restart your server when you modify this file
2
+
3
+ # Specifies gem version of Rails to use when vendor/rails is not present
4
+ #RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION
5
+
6
+ # Bootstrap the Rails environment, frameworks, and default configuration
7
+ require File.join(File.dirname(__FILE__), 'boot')
8
+
9
+ Rails::Initializer.run do |config|
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Add additional load paths for your own custom dirs
15
+ # config.load_paths += %W( #{RAILS_ROOT}/extras )
16
+
17
+ # Specify gems that this application depends on and have them installed with rake gems:install
18
+ # config.gem "bj"
19
+ # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
20
+ # config.gem "sqlite3-ruby", :lib => "sqlite3"
21
+ # config.gem "aws-s3", :lib => "aws/s3"
22
+
23
+ # Only load the plugins named here, in the order given (default is alphabetical).
24
+ # :all can be used as a placeholder for all plugins not explicitly named
25
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
26
+ config.plugin_paths += %W(#{RAILS_ROOT}/../../..)
27
+ config.plugins = [:active_scaffold]
28
+
29
+ # Skip frameworks you're not going to use. To use Rails without a database,
30
+ # you must remove the Active Record framework.
31
+ # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
32
+
33
+ # Activate observers that should always be running
34
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
35
+
36
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
37
+ # Run "rake -D time" for a list of tasks for finding time zone names.
38
+ config.time_zone = 'UTC'
39
+
40
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
41
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
42
+ # config.i18n.default_locale = :de
43
+ end
@@ -0,0 +1,17 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # In the development environment your application's code is reloaded on
4
+ # every request. This slows down response time but is perfect for development
5
+ # since you don't have to restart the webserver when you make code changes.
6
+ config.cache_classes = false
7
+
8
+ # Log error messages when you accidentally call methods on nil.
9
+ config.whiny_nils = true
10
+
11
+ # Show full error reports and disable caching
12
+ config.action_controller.consider_all_requests_local = true
13
+ config.action_view.debug_rjs = 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
@@ -0,0 +1,28 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The production environment is meant for finished, "live" apps.
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Full error reports are disabled and caching is turned on
8
+ config.action_controller.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+ config.action_view.cache_template_loading = true
11
+
12
+ # See everything in the log (default is :info)
13
+ # config.log_level = :debug
14
+
15
+ # Use a different logger for distributed setups
16
+ # config.logger = SyslogLogger.new
17
+
18
+ # Use a different cache store in production
19
+ # config.cache_store = :mem_cache_store
20
+
21
+ # Enable serving of images, stylesheets, and javascripts from an asset server
22
+ # config.action_controller.asset_host = "http://assets.example.com"
23
+
24
+ # Disable delivery errors, bad email addresses will be ignored
25
+ # config.action_mailer.raise_delivery_errors = false
26
+
27
+ # Enable threaded mode
28
+ # config.threadsafe!
@@ -0,0 +1,28 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+ config.cache_classes = true
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.action_controller.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+ config.action_view.cache_template_loading = true
16
+
17
+ # Disable request forgery protection in test environment
18
+ config.action_controller.allow_forgery_protection = false
19
+
20
+ # Tell Action Mailer not to deliver emails to the real world.
21
+ # The :test delivery method accumulates sent emails in the
22
+ # ActionMailer::Base.deliveries array.
23
+ config.action_mailer.delivery_method = :test
24
+
25
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
26
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
27
+ # like if you have constraints or database-specific column types
28
+ # config.active_record.schema_format = :sql
@@ -0,0 +1,7 @@
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 do debug a problem that might steem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
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
@@ -0,0 +1,5 @@
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
@@ -0,0 +1,19 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # These settings change the behavior of Rails 2 apps and will be defaults
4
+ # for Rails 3. You can remove this initializer when Rails 3 is released.
5
+
6
+ if defined?(ActiveRecord)
7
+ # Include Active Record class name as root for JSON serialized output.
8
+ ActiveRecord::Base.include_root_in_json = true
9
+
10
+ # Store the full class name (including module namespace) in STI type column.
11
+ ActiveRecord::Base.store_full_sti_class = true
12
+ end
13
+
14
+ # Use ISO 8601 format for JSON serialized times and dates.
15
+ ActiveSupport.use_standard_json_time_format = true
16
+
17
+ # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
18
+ # if you're including raw json in an HTML page.
19
+ ActiveSupport.escape_html_entities_in_json = false
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying cookie session data integrity.
4
+ # If you change this key, all old sessions 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
+ ActionController::Base.session = {
8
+ :key => '_mock_app_session',
9
+ :secret => 'ed0122432f6132fc5c99c928dc133a0863df7f24b0f2d53ce9dc2e9885a9b1f944d8ac6390333e2f1a72f902554bdaca75024fb23eb11a4548b0af4731439be2'
10
+ }
11
+
12
+ # Use the database for sessions instead of the cookie-based default,
13
+ # which shouldn't be used to store highly confidential information
14
+ # (create the session table with "rake db:sessions:create")
15
+ # ActionController::Base.session_store = :active_record_store
@@ -0,0 +1,5 @@
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"