Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of https://github.com/ryanb/railscasts-episodes

  • Loading branch information...
commit d57ec1eb3bdfdf692597c5e56aa3171343e83142 2 parents 4a4a295 + aa2b63f
@ryanb authored
Showing with 2,190 additions and 0 deletions.
  1. 0  episode-196/revised/{mailer-before → questionnaire-after}/.gitignore
  2. +38 −0 episode-196/revised/questionnaire-after/Gemfile
  3. +111 −0 episode-196/revised/questionnaire-after/Gemfile.lock
  4. +9 −0 episode-196/revised/questionnaire-after/README.rdoc
  5. +7 −0 episode-196/revised/questionnaire-after/Rakefile
  6. 0  episode-196/revised/{mailer-before → questionnaire-after}/app/assets/images/rails.png
  7. 0  episode-196/revised/{mailer-before → questionnaire-after}/app/assets/javascripts/application.js
  8. +14 −0 episode-196/revised/questionnaire-after/app/assets/javascripts/surveys.js.coffee
  9. +93 −0 episode-196/revised/questionnaire-after/app/assets/stylesheets/application.css
  10. +51 −0 episode-196/revised/questionnaire-after/app/assets/stylesheets/surveys.css.scss
  11. 0  episode-196/revised/{mailer-before → questionnaire-after}/app/controllers/application_controller.rb
  12. +41 −0 episode-196/revised/questionnaire-after/app/controllers/surveys_controller.rb
  13. +10 −0 episode-196/revised/questionnaire-after/app/helpers/application_helper.rb
  14. +2 −0  episode-196/revised/questionnaire-after/app/helpers/surveys_helper.rb
  15. 0  episode-196/revised/{mailer-before/vendor/plugins → questionnaire-after/app/mailers}/.gitkeep
  16. 0  episode-196/revised/{mailer-before/vendor/assets/stylesheets → questionnaire-after/app/models}/.gitkeep
  17. +4 −0 episode-196/revised/questionnaire-after/app/models/answer.rb
  18. +6 −0 episode-196/revised/questionnaire-after/app/models/question.rb
  19. +5 −0 episode-196/revised/questionnaire-after/app/models/survey.rb
  20. +17 −0 episode-196/revised/questionnaire-after/app/views/layouts/application.html.erb
  21. +6 −0 episode-196/revised/questionnaire-after/app/views/surveys/_answer_fields.html.erb
  22. +26 −0 episode-196/revised/questionnaire-after/app/views/surveys/_form.html.erb
  23. +10 −0 episode-196/revised/questionnaire-after/app/views/surveys/_question_fields.html.erb
  24. +3 −0  episode-196/revised/questionnaire-after/app/views/surveys/edit.html.erb
  25. +10 −0 episode-196/revised/questionnaire-after/app/views/surveys/index.html.erb
  26. +3 −0  episode-196/revised/questionnaire-after/app/views/surveys/new.html.erb
  27. +17 −0 episode-196/revised/questionnaire-after/app/views/surveys/show.html.erb
  28. +4 −0 episode-196/revised/questionnaire-after/config.ru
  29. +59 −0 episode-196/revised/questionnaire-after/config/application.rb
  30. 0  episode-196/revised/{mailer-before → questionnaire-after}/config/boot.rb
  31. +25 −0 episode-196/revised/questionnaire-after/config/database.yml
  32. +5 −0 episode-196/revised/questionnaire-after/config/environment.rb
  33. +37 −0 episode-196/revised/questionnaire-after/config/environments/development.rb
  34. +67 −0 episode-196/revised/questionnaire-after/config/environments/production.rb
  35. +37 −0 episode-196/revised/questionnaire-after/config/environments/test.rb
  36. 0  episode-196/revised/{mailer-before → questionnaire-after}/config/initializers/backtrace_silencers.rb
  37. 0  episode-196/revised/{mailer-before → questionnaire-after}/config/initializers/inflections.rb
  38. 0  episode-196/revised/{mailer-before → questionnaire-after}/config/initializers/mime_types.rb
  39. +7 −0 episode-196/revised/questionnaire-after/config/initializers/secret_token.rb
  40. +8 −0 episode-196/revised/questionnaire-after/config/initializers/session_store.rb
  41. 0  episode-196/revised/{mailer-before → questionnaire-after}/config/initializers/wrap_parameters.rb
  42. 0  episode-196/revised/{mailer-before → questionnaire-after}/config/locales/en.yml
  43. +4 −0 episode-196/revised/questionnaire-after/config/routes.rb
  44. +9 −0 episode-196/revised/questionnaire-after/db/migrate/20120417221609_create_surveys.rb
  45. +10 −0 episode-196/revised/questionnaire-after/db/migrate/20120417221626_create_questions.rb
  46. +10 −0 episode-196/revised/questionnaire-after/db/migrate/20120417221635_create_answers.rb
  47. +36 −0 episode-196/revised/questionnaire-after/db/schema.rb
  48. +26 −0 episode-196/revised/questionnaire-after/db/seeds.rb
  49. 0  episode-196/revised/{mailer-before → questionnaire-after}/doc/README_FOR_APP
  50. 0  episode-196/revised/{mailer-before/vendor/assets/javascripts → questionnaire-after/lib/assets}/.gitkeep
  51. 0  episode-196/revised/{mailer-before/test/unit → questionnaire-after/lib/tasks}/.gitkeep
  52. 0  episode-196/revised/{mailer-before/test/integration → questionnaire-after/log}/.gitkeep
  53. 0  episode-196/revised/{mailer-before → questionnaire-after}/public/404.html
  54. 0  episode-196/revised/{mailer-before → questionnaire-after}/public/422.html
  55. 0  episode-196/revised/{mailer-before → questionnaire-after}/public/500.html
  56. 0  episode-196/revised/{mailer-before → questionnaire-after}/public/favicon.ico
  57. 0  episode-196/revised/{mailer-before → questionnaire-after}/public/robots.txt
  58. 0  episode-196/revised/{mailer-before → questionnaire-after}/script/rails
  59. 0  episode-196/revised/{mailer-before/test/functional → questionnaire-after/test/fixtures}/.gitkeep
  60. +9 −0 episode-196/revised/questionnaire-after/test/fixtures/answers.yml
  61. +9 −0 episode-196/revised/questionnaire-after/test/fixtures/questions.yml
  62. +7 −0 episode-196/revised/questionnaire-after/test/fixtures/surveys.yml
  63. 0  episode-196/revised/{mailer-before/test/fixtures → questionnaire-after/test/functional}/.gitkeep
  64. +49 −0 episode-196/revised/questionnaire-after/test/functional/surveys_controller_test.rb
  65. 0  episode-196/revised/{mailer-before/log → questionnaire-after/test/integration}/.gitkeep
  66. 0  episode-196/revised/{mailer-before → questionnaire-after}/test/performance/browsing_test.rb
  67. 0  episode-196/revised/{mailer-before → questionnaire-after}/test/test_helper.rb
  68. 0  episode-196/revised/{mailer-before/lib/tasks → questionnaire-after/test/unit}/.gitkeep
  69. +7 −0 episode-196/revised/questionnaire-after/test/unit/answer_test.rb
  70. +4 −0 episode-196/revised/questionnaire-after/test/unit/helpers/surveys_helper_test.rb
  71. +7 −0 episode-196/revised/questionnaire-after/test/unit/question_test.rb
  72. +7 −0 episode-196/revised/questionnaire-after/test/unit/survey_test.rb
  73. 0  episode-196/revised/{mailer-before/lib/assets → questionnaire-after/vendor/assets/javascripts}/.gitkeep
  74. 0  episode-196/revised/{mailer-before/app/models → questionnaire-after/vendor/assets/stylesheets}/.gitkeep
  75. 0  episode-196/revised/{mailer-before/app/mailers → questionnaire-after/vendor/plugins}/.gitkeep
  76. 0  episode-196/revised/{mailer-after → questionnaire-before}/.gitignore
  77. +38 −0 episode-196/revised/questionnaire-before/Gemfile
  78. +111 −0 episode-196/revised/questionnaire-before/Gemfile.lock
  79. +9 −0 episode-196/revised/questionnaire-before/README.rdoc
  80. +7 −0 episode-196/revised/questionnaire-before/Rakefile
  81. 0  episode-196/revised/{mailer-after → questionnaire-before}/app/assets/images/rails.png
  82. 0  episode-196/revised/{mailer-after → questionnaire-before}/app/assets/javascripts/application.js
  83. 0  ...ets/javascripts/newsletters.js.coffee → questionnaire-before/app/assets/javascripts/surveys.js.coffee}
  84. +93 −0 episode-196/revised/questionnaire-before/app/assets/stylesheets/application.css
  85. +32 −0 episode-196/revised/questionnaire-before/app/assets/stylesheets/surveys.css.scss
  86. 0  episode-196/revised/{mailer-after → questionnaire-before}/app/controllers/application_controller.rb
  87. +41 −0 episode-196/revised/questionnaire-before/app/controllers/surveys_controller.rb
  88. 0  episode-196/revised/{mailer-before → questionnaire-before}/app/helpers/application_helper.rb
  89. +2 −0  episode-196/revised/questionnaire-before/app/helpers/surveys_helper.rb
  90. 0  episode-196/revised/{mailer-after/vendor/plugins → questionnaire-before/app/mailers}/.gitkeep
  91. 0  episode-196/revised/{mailer-after/vendor/assets/stylesheets → questionnaire-before/app/models}/.gitkeep
  92. +4 −0 episode-196/revised/questionnaire-before/app/models/answer.rb
  93. +5 −0 episode-196/revised/questionnaire-before/app/models/question.rb
  94. +4 −0 episode-196/revised/questionnaire-before/app/models/survey.rb
  95. +17 −0 episode-196/revised/questionnaire-before/app/views/layouts/application.html.erb
  96. +20 −0 episode-196/revised/questionnaire-before/app/views/surveys/_form.html.erb
  97. +3 −0  episode-196/revised/questionnaire-before/app/views/surveys/edit.html.erb
  98. +10 −0 episode-196/revised/questionnaire-before/app/views/surveys/index.html.erb
  99. +3 −0  episode-196/revised/questionnaire-before/app/views/surveys/new.html.erb
  100. +17 −0 episode-196/revised/questionnaire-before/app/views/surveys/show.html.erb
  101. +4 −0 episode-196/revised/questionnaire-before/config.ru
  102. +59 −0 episode-196/revised/questionnaire-before/config/application.rb
  103. 0  episode-196/revised/{mailer-after → questionnaire-before}/config/boot.rb
  104. +25 −0 episode-196/revised/questionnaire-before/config/database.yml
  105. +5 −0 episode-196/revised/questionnaire-before/config/environment.rb
  106. +37 −0 episode-196/revised/questionnaire-before/config/environments/development.rb
  107. +67 −0 episode-196/revised/questionnaire-before/config/environments/production.rb
  108. +37 −0 episode-196/revised/questionnaire-before/config/environments/test.rb
  109. 0  episode-196/revised/{mailer-after → questionnaire-before}/config/initializers/backtrace_silencers.rb
  110. 0  episode-196/revised/{mailer-after → questionnaire-before}/config/initializers/inflections.rb
  111. 0  episode-196/revised/{mailer-after → questionnaire-before}/config/initializers/mime_types.rb
  112. +7 −0 episode-196/revised/questionnaire-before/config/initializers/secret_token.rb
  113. +8 −0 episode-196/revised/questionnaire-before/config/initializers/session_store.rb
  114. 0  episode-196/revised/{mailer-after → questionnaire-before}/config/initializers/wrap_parameters.rb
  115. 0  episode-196/revised/{mailer-after → questionnaire-before}/config/locales/en.yml
  116. +4 −0 episode-196/revised/questionnaire-before/config/routes.rb
  117. +9 −0 episode-196/revised/questionnaire-before/db/migrate/20120417221609_create_surveys.rb
  118. +10 −0 episode-196/revised/questionnaire-before/db/migrate/20120417221626_create_questions.rb
  119. +10 −0 episode-196/revised/questionnaire-before/db/migrate/20120417221635_create_answers.rb
  120. +36 −0 episode-196/revised/questionnaire-before/db/schema.rb
  121. +26 −0 episode-196/revised/questionnaire-before/db/seeds.rb
  122. 0  episode-196/revised/{mailer-after → questionnaire-before}/doc/README_FOR_APP
  123. 0  episode-196/revised/{mailer-after/vendor/assets/javascripts → questionnaire-before/lib/assets}/.gitkeep
  124. 0  episode-196/revised/{mailer-after/test/unit → questionnaire-before/lib/tasks}/.gitkeep
  125. 0  episode-196/revised/{mailer-after/test/integration → questionnaire-before/log}/.gitkeep
  126. 0  episode-196/revised/{mailer-after → questionnaire-before}/public/404.html
  127. 0  episode-196/revised/{mailer-after → questionnaire-before}/public/422.html
  128. 0  episode-196/revised/{mailer-after → questionnaire-before}/public/500.html
  129. 0  episode-196/revised/{mailer-after → questionnaire-before}/public/favicon.ico
  130. 0  episode-196/revised/{mailer-after → questionnaire-before}/public/robots.txt
  131. 0  episode-196/revised/{mailer-after → questionnaire-before}/script/rails
  132. 0  episode-196/revised/{mailer-after/test/functional → questionnaire-before/test/fixtures}/.gitkeep
  133. +9 −0 episode-196/revised/questionnaire-before/test/fixtures/answers.yml
  134. +9 −0 episode-196/revised/questionnaire-before/test/fixtures/questions.yml
  135. +7 −0 episode-196/revised/questionnaire-before/test/fixtures/surveys.yml
  136. 0  episode-196/revised/{mailer-after/test/fixtures → questionnaire-before/test/functional}/.gitkeep
  137. +49 −0 episode-196/revised/questionnaire-before/test/functional/surveys_controller_test.rb
  138. 0  episode-196/revised/{mailer-after/log → questionnaire-before/test/integration}/.gitkeep
  139. 0  episode-196/revised/{mailer-after → questionnaire-before}/test/performance/browsing_test.rb
  140. 0  episode-196/revised/{mailer-after → questionnaire-before}/test/test_helper.rb
  141. 0  episode-196/revised/{mailer-after/lib/tasks → questionnaire-before/test/unit}/.gitkeep
  142. +7 −0 episode-196/revised/questionnaire-before/test/unit/answer_test.rb
  143. +4 −0 episode-196/revised/questionnaire-before/test/unit/helpers/surveys_helper_test.rb
  144. +7 −0 episode-196/revised/questionnaire-before/test/unit/question_test.rb
  145. +7 −0 episode-196/revised/questionnaire-before/test/unit/survey_test.rb
  146. 0  episode-196/revised/{mailer-after/lib/assets → questionnaire-before/vendor/assets/javascripts}/.gitkeep
  147. 0  episode-196/revised/{mailer-after/app/models → questionnaire-before/vendor/assets/stylesheets}/.gitkeep
  148. 0  episode-196/revised/{mailer-after/app/mailers → questionnaire-before/vendor/plugins}/.gitkeep
  149. +15 −0 episode-344/mailer-after/.gitignore
  150. 0  {episode-196/revised → episode-344}/mailer-after/Gemfile
  151. 0  {episode-196/revised → episode-344}/mailer-after/Gemfile.lock
  152. 0  {episode-196/revised → episode-344}/mailer-after/README.rdoc
  153. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/Rakefile
  154. BIN  episode-344/mailer-after/app/assets/images/rails.png
  155. +15 −0 episode-344/mailer-after/app/assets/javascripts/application.js
  156. 0  {episode-196/revised → episode-344}/mailer-after/app/assets/javascripts/newsletters.js.coffee
  157. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/app/assets/stylesheets/application.css
  158. 0  ...sode-196/revised/mailer-before → episode-344/mailer-after}/app/assets/stylesheets/newsletters.css.scss
  159. +3 −0  episode-344/mailer-after/app/controllers/application_controller.rb
  160. 0  {episode-196/revised → episode-344}/mailer-after/app/controllers/newsletters_controller.rb
  161. 0  {episode-196/revised → episode-344}/mailer-after/app/helpers/application_helper.rb
  162. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/app/helpers/newsletters_helper.rb
  163. 0  episode-344/mailer-after/app/mailers/.gitkeep
  164. 0  episode-344/mailer-after/app/models/.gitkeep
  165. 0  {episode-196/revised → episode-344}/mailer-after/app/models/newsletter.rb
  166. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/app/views/layouts/application.html.erb
  167. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/app/views/newsletters/index.html.erb
  168. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/config.ru
  169. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/config/application.rb
  170. +6 −0 episode-344/mailer-after/config/boot.rb
  171. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/config/database.yml
  172. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/config/environment.rb
  173. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/config/environments/development.rb
  174. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/config/environments/production.rb
  175. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/config/environments/test.rb
  176. +7 −0 episode-344/mailer-after/config/initializers/backtrace_silencers.rb
  177. +15 −0 episode-344/mailer-after/config/initializers/inflections.rb
  178. +5 −0 episode-344/mailer-after/config/initializers/mime_types.rb
  179. 0  {episode-196/revised → episode-344}/mailer-after/config/initializers/queue_classic.rb
  180. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/config/initializers/secret_token.rb
  181. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/config/initializers/session_store.rb
  182. +14 −0 episode-344/mailer-after/config/initializers/wrap_parameters.rb
  183. +5 −0 episode-344/mailer-after/config/locales/en.yml
  184. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/config/routes.rb
  185. 0  ...-196/revised/mailer-before → episode-344/mailer-after}/db/migrate/20120418194819_create_newsletters.rb
  186. 0  {episode-196/revised → episode-344}/mailer-after/db/migrate/20120418213929_add_queue_classic.rb
  187. 0  {episode-196/revised → episode-344}/mailer-after/db/migrate/20120418213940_setup_queue_classic.rb
  188. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/db/seeds.rb
  189. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/db/structure.sql
  190. +2 −0  episode-344/mailer-after/doc/README_FOR_APP
  191. 0  episode-344/mailer-after/lib/assets/.gitkeep
  192. 0  episode-344/mailer-after/lib/tasks/.gitkeep
  193. 0  {episode-196/revised → episode-344}/mailer-after/lib/tasks/queue_classic.rake
  194. 0  episode-344/mailer-after/log/.gitkeep
  195. +26 −0 episode-344/mailer-after/public/404.html
  196. +26 −0 episode-344/mailer-after/public/422.html
  197. +25 −0 episode-344/mailer-after/public/500.html
  198. 0  episode-344/mailer-after/public/favicon.ico
  199. +5 −0 episode-344/mailer-after/public/robots.txt
  200. +6 −0 episode-344/mailer-after/script/rails
  201. 0  episode-344/mailer-after/test/fixtures/.gitkeep
  202. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/test/fixtures/newsletters.yml
  203. 0  episode-344/mailer-after/test/functional/.gitkeep
  204. 0  ...e-196/revised/mailer-before → episode-344/mailer-after}/test/functional/newsletters_controller_test.rb
  205. 0  episode-344/mailer-after/test/integration/.gitkeep
  206. +12 −0 episode-344/mailer-after/test/performance/browsing_test.rb
  207. +13 −0 episode-344/mailer-after/test/test_helper.rb
  208. 0  episode-344/mailer-after/test/unit/.gitkeep
  209. 0  ...ode-196/revised/mailer-before → episode-344/mailer-after}/test/unit/helpers/newsletters_helper_test.rb
  210. 0  {episode-196/revised/mailer-before → episode-344/mailer-after}/test/unit/newsletter_test.rb
  211. 0  episode-344/mailer-after/vendor/assets/javascripts/.gitkeep
  212. 0  episode-344/mailer-after/vendor/assets/stylesheets/.gitkeep
  213. 0  episode-344/mailer-after/vendor/plugins/.gitkeep
  214. +15 −0 episode-344/mailer-before/.gitignore
  215. 0  {episode-196/revised → episode-344}/mailer-before/Gemfile
  216. 0  {episode-196/revised → episode-344}/mailer-before/Gemfile.lock
  217. 0  {episode-196/revised → episode-344}/mailer-before/README.rdoc
  218. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/Rakefile
  219. BIN  episode-344/mailer-before/app/assets/images/rails.png
  220. +15 −0 episode-344/mailer-before/app/assets/javascripts/application.js
  221. +3 −0  episode-344/mailer-before/app/assets/javascripts/newsletters.js.coffee
  222. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/app/assets/stylesheets/application.css
  223. 0  ...sode-196/revised/mailer-after → episode-344/mailer-before}/app/assets/stylesheets/newsletters.css.scss
  224. +3 −0  episode-344/mailer-before/app/controllers/application_controller.rb
  225. 0  {episode-196/revised → episode-344}/mailer-before/app/controllers/newsletters_controller.rb
  226. +2 −0  episode-344/mailer-before/app/helpers/application_helper.rb
  227. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/app/helpers/newsletters_helper.rb
  228. 0  episode-344/mailer-before/app/mailers/.gitkeep
  229. 0  episode-344/mailer-before/app/models/.gitkeep
  230. 0  {episode-196/revised → episode-344}/mailer-before/app/models/newsletter.rb
  231. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/app/views/layouts/application.html.erb
  232. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/app/views/newsletters/index.html.erb
  233. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/config.ru
  234. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/config/application.rb
  235. +6 −0 episode-344/mailer-before/config/boot.rb
  236. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/config/database.yml
  237. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/config/environment.rb
  238. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/config/environments/development.rb
  239. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/config/environments/production.rb
  240. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/config/environments/test.rb
  241. +7 −0 episode-344/mailer-before/config/initializers/backtrace_silencers.rb
  242. +15 −0 episode-344/mailer-before/config/initializers/inflections.rb
  243. +5 −0 episode-344/mailer-before/config/initializers/mime_types.rb
  244. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/config/initializers/secret_token.rb
  245. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/config/initializers/session_store.rb
  246. +14 −0 episode-344/mailer-before/config/initializers/wrap_parameters.rb
  247. +5 −0 episode-344/mailer-before/config/locales/en.yml
  248. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/config/routes.rb
  249. 0  ...-196/revised/mailer-after → episode-344/mailer-before}/db/migrate/20120418194819_create_newsletters.rb
  250. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/db/seeds.rb
  251. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/db/structure.sql
  252. +2 −0  episode-344/mailer-before/doc/README_FOR_APP
  253. 0  episode-344/mailer-before/lib/assets/.gitkeep
  254. 0  episode-344/mailer-before/lib/tasks/.gitkeep
  255. 0  episode-344/mailer-before/log/.gitkeep
  256. +26 −0 episode-344/mailer-before/public/404.html
  257. +26 −0 episode-344/mailer-before/public/422.html
  258. +25 −0 episode-344/mailer-before/public/500.html
  259. 0  episode-344/mailer-before/public/favicon.ico
  260. +5 −0 episode-344/mailer-before/public/robots.txt
  261. +6 −0 episode-344/mailer-before/script/rails
  262. 0  episode-344/mailer-before/test/fixtures/.gitkeep
  263. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/test/fixtures/newsletters.yml
  264. 0  episode-344/mailer-before/test/functional/.gitkeep
  265. 0  ...e-196/revised/mailer-after → episode-344/mailer-before}/test/functional/newsletters_controller_test.rb
  266. 0  episode-344/mailer-before/test/integration/.gitkeep
  267. +12 −0 episode-344/mailer-before/test/performance/browsing_test.rb
  268. +13 −0 episode-344/mailer-before/test/test_helper.rb
  269. 0  episode-344/mailer-before/test/unit/.gitkeep
  270. 0  ...ode-196/revised/mailer-after → episode-344/mailer-before}/test/unit/helpers/newsletters_helper_test.rb
  271. 0  {episode-196/revised/mailer-after → episode-344/mailer-before}/test/unit/newsletter_test.rb
  272. 0  episode-344/mailer-before/vendor/assets/javascripts/.gitkeep
  273. 0  episode-344/mailer-before/vendor/assets/stylesheets/.gitkeep
  274. 0  episode-344/mailer-before/vendor/plugins/.gitkeep
View
0  episode-196/revised/mailer-before/.gitignore → ...96/revised/questionnaire-after/.gitignore
File renamed without changes
View
38 episode-196/revised/questionnaire-after/Gemfile
@@ -0,0 +1,38 @@
+source 'https://rubygems.org'
+
+gem 'rails', '3.2.3'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3'
+
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.2.3'
+ gem 'coffee-rails', '~> 3.2.1'
+
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+ # gem 'therubyracer', :platform => :ruby
+
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
+# To use ActiveModel has_secure_password
+# gem 'bcrypt-ruby', '~> 3.0.0'
+
+# To use Jbuilder templates for JSON
+# gem 'jbuilder'
+
+# Use unicorn as the app server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger
+# gem 'ruby-debug19', :require => 'ruby-debug'
View
111 episode-196/revised/questionnaire-after/Gemfile.lock
@@ -0,0 +1,111 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (3.2.3)
+ actionpack (= 3.2.3)
+ mail (~> 2.4.4)
+ actionpack (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.2)
+ activemodel (3.2.3)
+ activesupport (= 3.2.3)
+ builder (~> 3.0.0)
+ activerecord (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ activesupport (3.2.3)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ arel (3.0.2)
+ builder (3.0.0)
+ coffee-rails (3.2.2)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.2.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.3.1)
+ erubis (2.7.0)
+ execjs (1.3.0)
+ multi_json (~> 1.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ journey (1.0.3)
+ jquery-rails (2.0.2)
+ railties (>= 3.2.0, < 5.0)
+ thor (~> 0.14)
+ json (1.6.6)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.18)
+ multi_json (1.3.2)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.2.3)
+ actionmailer (= 3.2.3)
+ actionpack (= 3.2.3)
+ activerecord (= 3.2.3)
+ activeresource (= 3.2.3)
+ activesupport (= 3.2.3)
+ bundler (~> 1.0)
+ railties (= 3.2.3)
+ railties (3.2.3)
+ actionpack (= 3.2.3)
+ activesupport (= 3.2.3)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ sass (3.1.15)
+ sass-rails (3.2.5)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ sprockets (2.1.2)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.6)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.33)
+ uglifier (1.2.4)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-rails (~> 3.2.1)
+ jquery-rails
+ rails (= 3.2.3)
+ sass-rails (~> 3.2.3)
+ sqlite3
+ uglifier (>= 1.0.3)
View
9 episode-196/revised/questionnaire-after/README.rdoc
@@ -0,0 +1,9 @@
+= RailsCasts Example Application
+
+Run these commands to try it out.
+
+ bundle
+ rake db:setup
+ rails s
+
+Requires Ruby 1.9.2 or later to run.
View
7 episode-196/revised/questionnaire-after/Rakefile
@@ -0,0 +1,7 @@
+#!/usr/bin/env rake
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+Questionnaire::Application.load_tasks
View
0  ...mailer-before/app/assets/images/rails.png → ...onnaire-after/app/assets/images/rails.png
File renamed without changes
View
0  ...ore/app/assets/javascripts/application.js → ...ter/app/assets/javascripts/application.js
File renamed without changes
View
14 episode-196/revised/questionnaire-after/app/assets/javascripts/surveys.js.coffee
@@ -0,0 +1,14 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
+jQuery ->
+ $('form').on 'click', '.remove_fields', (event) ->
+ $(this).prev('input[type=hidden]').val('1')
+ $(this).closest('fieldset').hide()
+ event.preventDefault()
+
+ $('form').on 'click', '.add_fields', (event) ->
+ time = new Date().getTime()
+ regexp = new RegExp($(this).data('id'), 'g')
+ $(this).before($(this).data('fields').replace(regexp, time))
+ event.preventDefault()
View
93 episode-196/revised/questionnaire-after/app/assets/stylesheets/application.css
@@ -0,0 +1,93 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
+ * compiled file, but it's generally better to create a new file per style scope.
+ *
+ *= require_self
+ *= require_tree .
+*/
+
+html, body {
+ background-color: #4B7399;
+ font-family: Verdana, Helvetica, Arial;
+ font-size: 14px;
+}
+
+a img {
+ border: none;
+}
+
+a {
+ color: #0000FF;
+}
+
+.clear {
+ clear: both;
+ height: 0;
+ overflow: hidden;
+}
+
+#container {
+ width: 75%;
+ margin: 0 auto;
+ background-color: #FFF;
+ padding: 20px 40px;
+ border: solid 1px black;
+ margin-top: 20px;
+}
+
+#flash_notice, #flash_error, #flash_alert {
+ padding: 5px 8px;
+ margin: 10px 0;
+}
+
+#flash_notice {
+ background-color: #CFC;
+ border: solid 1px #6C6;
+}
+
+#flash_error, #flash_alert {
+ background-color: #FCC;
+ border: solid 1px #C66;
+}
+
+.field_with_errors {
+ display: inline;
+}
+
+.error_messages {
+ width: 400px;
+ border: 2px solid #CF0000;
+ padding: 0px;
+ padding-bottom: 12px;
+ margin-bottom: 20px;
+ background-color: #f0f0f0;
+ font-size: 12px;
+}
+
+.error_messages h2 {
+ text-align: left;
+ font-weight: bold;
+ padding: 5px 10px;
+ font-size: 12px;
+ margin: 0;
+ background-color: #c00;
+ color: #fff;
+}
+
+.error_messages p {
+ margin: 8px 10px;
+}
+
+.error_messages ul {
+ margin-bottom: 0;
+}
+
+form .field, form .actions {
+ margin: 12px 0;
+}
View
51 episode-196/revised/questionnaire-after/app/assets/stylesheets/surveys.css.scss
@@ -0,0 +1,51 @@
+// Place all the styles related to the surveys controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+.article {
+ h2 {
+ font-size: 18px;
+ margin-top: 20px;
+ margin-bottom: 3px;
+ }
+}
+
+.questions {
+ list-style: none;
+ font-weight: bold;
+ margin: 0;
+ padding: 0;
+ > li {
+ margin: 20px 0;
+ padding: 0;
+ }
+}
+
+.answers {
+ list-style: upper-alpha;
+ font-weight: normal;
+ margin: 0;
+ padding: 0;
+ > li {
+ margin: 5px 0;
+ margin-left: 25px;
+ }
+}
+
+form > fieldset {
+ border: none;
+ border: solid 1px #CCC;
+ padding: 10px 15px;
+ margin: 15px 0;
+ fieldset {
+ border: none;
+ margin: 0;
+ margin: 10px 0;
+ padding: 0;
+ }
+}
+
+textarea {
+ height: 40px;
+ width: 350px;
+ margin-top: 3px;
+}
View
0  ...app/controllers/application_controller.rb → ...app/controllers/application_controller.rb
File renamed without changes
View
41 episode-196/revised/questionnaire-after/app/controllers/surveys_controller.rb
@@ -0,0 +1,41 @@
+class SurveysController < ApplicationController
+ def index
+ @surveys = Survey.all
+ end
+
+ def show
+ @survey = Survey.find(params[:id])
+ end
+
+ def new
+ @survey = Survey.new
+ end
+
+ def create
+ @survey = Survey.new(params[:survey])
+ if @survey.save
+ redirect_to @survey, notice: "Successfully created survey."
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @survey = Survey.find(params[:id])
+ end
+
+ def update
+ @survey = Survey.find(params[:id])
+ if @survey.update_attributes(params[:survey])
+ redirect_to @survey, notice: "Successfully updated survey."
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @survey = Survey.find(params[:id])
+ @survey.destroy
+ redirect_to surveys_url, notice: "Successfully destroyed survey."
+ end
+end
View
10 episode-196/revised/questionnaire-after/app/helpers/application_helper.rb
@@ -0,0 +1,10 @@
+module ApplicationHelper
+ def link_to_add_fields(name, f, association)
+ new_object = f.object.send(association).klass.new
+ id = new_object.object_id
+ fields = f.fields_for(association, new_object, child_index: id) do |builder|
+ render(association.to_s.singularize + "_fields", f: builder)
+ end
+ link_to(name, '#', class: "add_fields", data: {id: id, fields: fields.gsub("\n", "")})
+ end
+end
View
2  episode-196/revised/questionnaire-after/app/helpers/surveys_helper.rb
@@ -0,0 +1,2 @@
+module SurveysHelper
+end
View
0  ...sed/mailer-before/vendor/plugins/.gitkeep → .../questionnaire-after/app/mailers/.gitkeep
File renamed without changes
View
0  ...before/vendor/assets/stylesheets/.gitkeep → ...d/questionnaire-after/app/models/.gitkeep
File renamed without changes
View
4 episode-196/revised/questionnaire-after/app/models/answer.rb
@@ -0,0 +1,4 @@
+class Answer < ActiveRecord::Base
+ attr_accessible :content, :question_id
+ belongs_to :question
+end
View
6 episode-196/revised/questionnaire-after/app/models/question.rb
@@ -0,0 +1,6 @@
+class Question < ActiveRecord::Base
+ attr_accessible :content, :survey_id, :answers_attributes
+ belongs_to :survey
+ has_many :answers
+ accepts_nested_attributes_for :answers, allow_destroy: true
+end
View
5 episode-196/revised/questionnaire-after/app/models/survey.rb
@@ -0,0 +1,5 @@
+class Survey < ActiveRecord::Base
+ attr_accessible :name, :questions_attributes
+ has_many :questions
+ accepts_nested_attributes_for :questions, allow_destroy: true
+end
View
17 episode-196/revised/questionnaire-after/app/views/layouts/application.html.erb
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Questionnaire</title>
+ <%= stylesheet_link_tag "application", media: "all" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tag %>
+ </head>
+ <body>
+ <div id="container">
+ <% flash.each do |name, msg| %>
+ <%= content_tag :div, msg, id: "flash_#{name}" %>
+ <% end %>
+ <%= yield %>
+ </div>
+ </body>
+</html>
View
6 episode-196/revised/questionnaire-after/app/views/surveys/_answer_fields.html.erb
@@ -0,0 +1,6 @@
+<fieldset>
+ <%= f.label :content, "Answer" %>
+ <%= f.text_field :content %>
+ <%= f.hidden_field :_destroy %>
+ <%= link_to "remove", '#', class: "remove_fields" %>
+</fieldset>
View
26 episode-196/revised/questionnaire-after/app/views/surveys/_form.html.erb
@@ -0,0 +1,26 @@
+<%= form_for @survey do |f| %>
+ <% if @survey.errors.any? %>
+ <div class="error_messages">
+ <h2><%= pluralize(@survey.errors.count, "error") %> prohibited this survey from being saved:</h2>
+ <ul>
+ <% @survey.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :name %><br />
+ <%= f.text_field :name %>
+ </div>
+
+ <%= f.fields_for :questions do |builder| %>
+ <%= render 'question_fields', f: builder %>
+ <% end %>
+ <%= link_to_add_fields "Add Question", f, :questions %>
+
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
View
10 episode-196/revised/questionnaire-after/app/views/surveys/_question_fields.html.erb
@@ -0,0 +1,10 @@
+<fieldset>
+ <%= f.label :content, "Question" %><br />
+ <%= f.text_area :content %><br />
+ <%= f.check_box :_destroy %>
+ <%= f.label :_destroy, "Remove Question" %>
+ <%= f.fields_for :answers do |builder| %>
+ <%= render 'answer_fields', f: builder %>
+ <% end %>
+ <%= link_to_add_fields "Add Answer", f, :answers %>
+</fieldset>
View
3  episode-196/revised/questionnaire-after/app/views/surveys/edit.html.erb
@@ -0,0 +1,3 @@
+<h1>Editing Survey</h1>
+
+<%= render "form" %>
View
10 episode-196/revised/questionnaire-after/app/views/surveys/index.html.erb
@@ -0,0 +1,10 @@
+<h1>Surveys</h1>
+
+<% @surveys.each do |survey| %>
+ <div class="article">
+ <h2><%= link_to survey.name, survey %></h2>
+ <%= pluralize(survey.questions.size, "Question") %>
+ </div>
+<% end %>
+
+<p><%= link_to 'New Survey', new_survey_path %></p>
View
3  episode-196/revised/questionnaire-after/app/views/surveys/new.html.erb
@@ -0,0 +1,3 @@
+<h1>New Survey</h1>
+
+<%= render "form" %>
View
17 episode-196/revised/questionnaire-after/app/views/surveys/show.html.erb
@@ -0,0 +1,17 @@
+<h1><%= @survey.name %></h1>
+
+<ol class="questions">
+<% @survey.questions.each do |question| %>
+ <li>
+ <%= question.content %>
+ <ol class="answers">
+ <% question.answers.each do |answer| %>
+ <li><%= answer.content %></li>
+ <% end %>
+ </ol>
+ </li>
+<% end %>
+</ol>
+
+<%= link_to 'Edit', edit_survey_path(@survey) %> |
+<%= link_to 'Back to Surveys', surveys_path %>
View
4 episode-196/revised/questionnaire-after/config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Questionnaire::Application
View
59 episode-196/revised/questionnaire-after/config/application.rb
@@ -0,0 +1,59 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+if defined?(Bundler)
+ # If you precompile assets before deploying to production, use this line
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
+ # If you want your assets lazily compiled in production, use this line
+ # Bundler.require(:default, :assets, Rails.env)
+end
+
+module Questionnaire
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Custom directories with classes and modules you want to be autoloadable.
+ # config.autoload_paths += %W(#{config.root}/extras)
+
+ # Only load the plugins named here, in the order given (default is alphabetical).
+ # :all can be used as a placeholder for all plugins not explicitly named.
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Activate observers that should always be running.
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # Configure the default encoding used in templates for Ruby 1.9.
+ config.encoding = "utf-8"
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters += [:password]
+
+ # Use SQL instead of Active Record's schema dumper when creating the database.
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
+
+ # Enforce whitelist mode for mass assignment.
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
+ # parameters by using an attr_accessible or attr_protected declaration.
+ config.active_record.whitelist_attributes = true
+
+ # Enable the asset pipeline
+ config.assets.enabled = true
+
+ # Version of your assets, change this if you want to expire all your assets
+ config.assets.version = '1.0'
+ end
+end
View
0  ...-196/revised/mailer-before/config/boot.rb → ...evised/questionnaire-after/config/boot.rb
File renamed without changes
View
25 episode-196/revised/questionnaire-after/config/database.yml
@@ -0,0 +1,25 @@
+# SQLite version 3.x
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem 'sqlite3'
+development:
+ adapter: sqlite3
+ database: db/development.sqlite3
+ pool: 5
+ timeout: 5000
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ adapter: sqlite3
+ database: db/test.sqlite3
+ pool: 5
+ timeout: 5000
+
+production:
+ adapter: sqlite3
+ database: db/production.sqlite3
+ pool: 5
+ timeout: 5000
View
5 episode-196/revised/questionnaire-after/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Questionnaire::Application.initialize!
View
37 episode-196/revised/questionnaire-after/config/environments/development.rb
@@ -0,0 +1,37 @@
+Questionnaire::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.cache_classes = false
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger
+ config.active_support.deprecation = :log
+
+ # Only use best-standards-support built into browsers
+ config.action_dispatch.best_standards_support = :builtin
+
+ # Raise exception on mass assignment protection for Active Record models
+ config.active_record.mass_assignment_sanitizer = :strict
+
+ # Log the query plan for queries taking more than this (works
+ # with SQLite, MySQL, and PostgreSQL)
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
+
+ # Do not compress assets
+ config.assets.compress = false
+
+ # Expands the lines which load the assets
+ config.assets.debug = true
+end
View
67 episode-196/revised/questionnaire-after/config/environments/production.rb
@@ -0,0 +1,67 @@
+Questionnaire::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # Code is not reloaded between requests
+ config.cache_classes = true
+
+ # Full error reports are disabled and caching is turned on
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Disable Rails's static asset server (Apache or nginx will already do this)
+ config.serve_static_assets = false
+
+ # Compress JavaScripts and CSS
+ config.assets.compress = true
+
+ # Don't fallback to assets pipeline if a precompiled asset is missed
+ config.assets.compile = false
+
+ # Generate digests for assets URLs
+ config.assets.digest = true
+
+ # Defaults to Rails.root.join("public/assets")
+ # config.assets.manifest = YOUR_PATH
+
+ # Specifies the header that your server uses for sending files
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
+
+ # See everything in the log (default is :info)
+ # config.log_level = :debug
+
+ # Prepend all log lines with the following tags
+ # config.log_tags = [ :subdomain, :uuid ]
+
+ # Use a different logger for distributed setups
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
+
+ # Use a different cache store in production
+ # config.cache_store = :mem_cache_store
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
+ # config.action_controller.asset_host = "http://assets.example.com"
+
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
+ # config.assets.precompile += %w( search.js )
+
+ # Disable delivery errors, bad email addresses will be ignored
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable threaded mode
+ # config.threadsafe!
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation can not be found)
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners
+ config.active_support.deprecation = :notify
+
+ # Log the query plan for queries taking more than this (works
+ # with SQLite, MySQL, and PostgreSQL)
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
+end
View
37 episode-196/revised/questionnaire-after/config/environments/test.rb
@@ -0,0 +1,37 @@
+Questionnaire::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
+
+ # Configure static asset server for tests with Cache-Control for performance
+ config.serve_static_assets = true
+ config.static_cache_control = "public, max-age=3600"
+
+ # Log error messages when you accidentally call methods on nil
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Raise exceptions instead of rendering exception templates
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment
+ config.action_controller.allow_forgery_protection = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Raise exception on mass assignment protection for Active Record models
+ config.active_record.mass_assignment_sanitizer = :strict
+
+ # Print deprecation notices to the stderr
+ config.active_support.deprecation = :stderr
+end
View
0  ...onfig/initializers/backtrace_silencers.rb → ...onfig/initializers/backtrace_silencers.rb
File renamed without changes
View
0  ...before/config/initializers/inflections.rb → ...-after/config/initializers/inflections.rb
File renamed without changes
View
0  ...-before/config/initializers/mime_types.rb → ...e-after/config/initializers/mime_types.rb
File renamed without changes
View
7 episode-196/revised/questionnaire-after/config/initializers/secret_token.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+Questionnaire::Application.config.secret_token = '384ac2bb060fb1764a69439a7f5a763fb1e250d3890a425a5508e66d49618b9799fe93c137665b27eeece1c55fec1cb1d8daad8756d968ab3d849d040fe7f7a1'
View
8 episode-196/revised/questionnaire-after/config/initializers/session_store.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+Questionnaire::Application.config.session_store :cookie_store, key: '_questionnaire_session'
+
+# Use the database for sessions instead of the cookie-based default,
+# which shouldn't be used to store highly confidential information
+# (create the session table with "rails generate session_migration")
+# Questionnaire::Application.config.session_store :active_record_store
View
0  ...re/config/initializers/wrap_parameters.rb → ...er/config/initializers/wrap_parameters.rb
File renamed without changes
View
0  ...vised/mailer-before/config/locales/en.yml → ...questionnaire-after/config/locales/en.yml
File renamed without changes
View
4 episode-196/revised/questionnaire-after/config/routes.rb
@@ -0,0 +1,4 @@
+Questionnaire::Application.routes.draw do
+ resources :surveys
+ root to: 'surveys#index'
+end
View
9 episode-196/revised/questionnaire-after/db/migrate/20120417221609_create_surveys.rb
@@ -0,0 +1,9 @@
+class CreateSurveys < ActiveRecord::Migration
+ def change
+ create_table :surveys do |t|
+ t.string :name
+
+ t.timestamps
+ end
+ end
+end
View
10 episode-196/revised/questionnaire-after/db/migrate/20120417221626_create_questions.rb
@@ -0,0 +1,10 @@
+class CreateQuestions < ActiveRecord::Migration
+ def change
+ create_table :questions do |t|
+ t.integer :survey_id
+ t.text :content
+
+ t.timestamps
+ end
+ end
+end
View
10 episode-196/revised/questionnaire-after/db/migrate/20120417221635_create_answers.rb
@@ -0,0 +1,10 @@
+class CreateAnswers < ActiveRecord::Migration
+ def change
+ create_table :answers do |t|
+ t.integer :question_id
+ t.text :content
+
+ t.timestamps
+ end
+ end
+end
View
36 episode-196/revised/questionnaire-after/db/schema.rb
@@ -0,0 +1,36 @@
+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20120417221635) do
+
+ create_table "answers", :force => true do |t|
+ t.integer "question_id"
+ t.text "content"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "questions", :force => true do |t|
+ t.integer "survey_id"
+ t.text "content"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "surveys", :force => true do |t|
+ t.string "name"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+end
View
26 episode-196/revised/questionnaire-after/db/seeds.rb
@@ -0,0 +1,26 @@
+survey = Survey.create! name: "Rails Survey"
+question = survey.questions.create! content: "What testing framework do you prefer?"
+question.answers.create! content: "Test::Unit"
+question.answers.create! content: "Rspec"
+question.answers.create! content: "Minitest"
+question.answers.create! content: "Other/None"
+
+question = survey.questions.create! content: "How many applications do you have in production?"
+question.answers.create! content: "0"
+question.answers.create! content: "1-2"
+question.answers.create! content: "3-5"
+question.answers.create! content: "6+"
+
+question = survey.questions.create! content: "What is the answer to the universe and everything?"
+question.answers.create! content: "42"
+
+survey = Survey.create! name: "What's your favorite Pizza?"
+survey.questions.create! content: "What's your favorite kind of cheese?"
+survey.questions.create! content: "Favorite veggie?"
+survey.questions.create! content: "Favorite meat?"
+survey.questions.create! content: "Do you like thin, medium, or deep dish crust?"
+
+survey = Survey.create! name: "Superhero Questionnaire"
+survey.questions.create! content: "Batman or Superman?"
+survey.questions.create! content: "Spiderman or Flash?"
+survey.questions.create! content: "Aquaman or Green Lantern?"
View
0  .../revised/mailer-before/doc/README_FOR_APP → ...ed/questionnaire-after/doc/README_FOR_APP
File renamed without changes
View
0  ...before/vendor/assets/javascripts/.gitkeep → ...d/questionnaire-after/lib/assets/.gitkeep
File renamed without changes
View
0  .../revised/mailer-before/test/unit/.gitkeep → ...ed/questionnaire-after/lib/tasks/.gitkeep
File renamed without changes
View
0  ...d/mailer-before/test/integration/.gitkeep → .../revised/questionnaire-after/log/.gitkeep
File renamed without changes
View
0  ...196/revised/mailer-before/public/404.html → ...vised/questionnaire-after/public/404.html
File renamed without changes
View
0  ...196/revised/mailer-before/public/422.html → ...vised/questionnaire-after/public/422.html
File renamed without changes
View
0  ...196/revised/mailer-before/public/500.html → ...vised/questionnaire-after/public/500.html
File renamed without changes
View
0  .../revised/mailer-before/public/favicon.ico → ...ed/questionnaire-after/public/favicon.ico
File renamed without changes
View
0  ...6/revised/mailer-before/public/robots.txt → ...sed/questionnaire-after/public/robots.txt
File renamed without changes
View
0  ...de-196/revised/mailer-before/script/rails → .../revised/questionnaire-after/script/rails
File renamed without changes
View
0  ...ed/mailer-before/test/functional/.gitkeep → ...uestionnaire-after/test/fixtures/.gitkeep
File renamed without changes
View
9 episode-196/revised/questionnaire-after/test/fixtures/answers.yml
@@ -0,0 +1,9 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ question_id: 1
+ content: MyText
+
+two:
+ question_id: 1
+ content: MyText
View
9 episode-196/revised/questionnaire-after/test/fixtures/questions.yml
@@ -0,0 +1,9 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ survey_id: 1
+ content: MyText
+
+two:
+ survey_id: 1
+ content: MyText
View
7 episode-196/revised/questionnaire-after/test/fixtures/surveys.yml
@@ -0,0 +1,7 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ name: MyString
+
+two:
+ name: MyString
View
0  ...ised/mailer-before/test/fixtures/.gitkeep → ...stionnaire-after/test/functional/.gitkeep
File renamed without changes
View
49 episode-196/revised/questionnaire-after/test/functional/surveys_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class SurveysControllerTest < ActionController::TestCase
+ setup do
+ @survey = surveys(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:surveys)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create survey" do
+ assert_difference('Survey.count') do
+ post :create, survey: { name: @survey.name }
+ end
+
+ assert_redirected_to survey_path(assigns(:survey))
+ end
+
+ test "should show survey" do
+ get :show, id: @survey
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @survey
+ assert_response :success
+ end
+
+ test "should update survey" do
+ put :update, id: @survey, survey: { name: @survey.name }
+ assert_redirected_to survey_path(assigns(:survey))
+ end
+
+ test "should destroy survey" do
+ assert_difference('Survey.count', -1) do
+ delete :destroy, id: @survey
+ end
+
+ assert_redirected_to surveys_path
+ end
+end
View
0  ...de-196/revised/mailer-before/log/.gitkeep → ...tionnaire-after/test/integration/.gitkeep
File renamed without changes
View
0  ...-before/test/performance/browsing_test.rb → ...e-after/test/performance/browsing_test.rb
File renamed without changes
View
0  ...revised/mailer-before/test/test_helper.rb → ...d/questionnaire-after/test/test_helper.rb
File renamed without changes
View
0  .../revised/mailer-before/lib/tasks/.gitkeep → ...ed/questionnaire-after/test/unit/.gitkeep
File renamed without changes
View
7 episode-196/revised/questionnaire-after/test/unit/answer_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class AnswerTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
View
4 episode-196/revised/questionnaire-after/test/unit/helpers/surveys_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class SurveysHelperTest < ActionView::TestCase
+end
View
7 episode-196/revised/questionnaire-after/test/unit/question_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class QuestionTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
View
7 episode-196/revised/questionnaire-after/test/unit/survey_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class SurveyTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
View
0  ...revised/mailer-before/lib/assets/.gitkeep → ...-after/vendor/assets/javascripts/.gitkeep
File renamed without changes
View
0  ...revised/mailer-before/app/models/.gitkeep → ...-after/vendor/assets/stylesheets/.gitkeep
File renamed without changes
View
0  ...evised/mailer-before/app/mailers/.gitkeep → ...estionnaire-after/vendor/plugins/.gitkeep
File renamed without changes
View
0  episode-196/revised/mailer-after/.gitignore → ...6/revised/questionnaire-before/.gitignore
File renamed without changes
View
38 episode-196/revised/questionnaire-before/Gemfile
@@ -0,0 +1,38 @@
+source 'https://rubygems.org'
+
+gem 'rails', '3.2.3'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3'
+
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.2.3'
+ gem 'coffee-rails', '~> 3.2.1'
+
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+ # gem 'therubyracer', :platform => :ruby
+
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
+# To use ActiveModel has_secure_password
+# gem 'bcrypt-ruby', '~> 3.0.0'
+
+# To use Jbuilder templates for JSON
+# gem 'jbuilder'
+
+# Use unicorn as the app server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger
+# gem 'ruby-debug19', :require => 'ruby-debug'
View
111 episode-196/revised/questionnaire-before/Gemfile.lock
@@ -0,0 +1,111 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (3.2.3)
+ actionpack (= 3.2.3)
+ mail (~> 2.4.4)
+ actionpack (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.2)
+ activemodel (3.2.3)
+ activesupport (= 3.2.3)
+ builder (~> 3.0.0)
+ activerecord (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ activesupport (3.2.3)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ arel (3.0.2)
+ builder (3.0.0)
+ coffee-rails (3.2.2)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.2.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.3.1)
+ erubis (2.7.0)
+ execjs (1.3.0)
+ multi_json (~> 1.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ journey (1.0.3)
+ jquery-rails (2.0.2)
+ railties (>= 3.2.0, < 5.0)
+ thor (~> 0.14)
+ json (1.6.6)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.18)
+ multi_json (1.3.2)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.2.3)
+ actionmailer (= 3.2.3)
+ actionpack (= 3.2.3)
+ activerecord (= 3.2.3)
+ activeresource (= 3.2.3)
+ activesupport (= 3.2.3)
+ bundler (~> 1.0)
+ railties (= 3.2.3)
+ railties (3.2.3)
+ actionpack (= 3.2.3)
+ activesupport (= 3.2.3)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ sass (3.1.15)
+ sass-rails (3.2.5)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ sprockets (2.1.2)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.6)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.33)
+ uglifier (1.2.4)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-rails (~> 3.2.1)
+ jquery-rails
+ rails (= 3.2.3)
+ sass-rails (~> 3.2.3)
+ sqlite3
+ uglifier (>= 1.0.3)
View
9 episode-196/revised/questionnaire-before/README.rdoc
@@ -0,0 +1,9 @@
+= RailsCasts Example Application
+
+Run these commands to try it out.
+
+ bundle
+ rake db:setup
+ rails s
+
+Requires Ruby 1.9.2 or later to run.
View
7 episode-196/revised/questionnaire-before/Rakefile
@@ -0,0 +1,7 @@
+#!/usr/bin/env rake
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+Questionnaire::Application.load_tasks
View
0  .../mailer-after/app/assets/images/rails.png → ...nnaire-before/app/assets/images/rails.png
File renamed without changes
View
0  ...ter/app/assets/javascripts/application.js → ...ore/app/assets/javascripts/application.js
File renamed without changes
View
0  .../assets/javascripts/newsletters.js.coffee → .../app/assets/javascripts/surveys.js.coffee
File renamed without changes
View
93 episode-196/revised/questionnaire-before/app/assets/stylesheets/application.css
@@ -0,0 +1,93 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
+ *
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
+ * compiled file, but it's generally better to create a new file per style scope.
+ *
+ *= require_self
+ *= require_tree .
+*/
+
+html, body {
+ background-color: #4B7399;
+ font-family: Verdana, Helvetica, Arial;
+ font-size: 14px;
+}
+
+a img {
+ border: none;
+}
+
+a {
+ color: #0000FF;
+}
+
+.clear {
+ clear: both;
+ height: 0;
+ overflow: hidden;
+}
+
+#container {
+ width: 75%;
+ margin: 0 auto;
+ background-color: #FFF;
+ padding: 20px 40px;
+ border: solid 1px black;
+ margin-top: 20px;
+}
+
+#flash_notice, #flash_error, #flash_alert {
+ padding: 5px 8px;
+ margin: 10px 0;
+}
+
+#flash_notice {
+ background-color: #CFC;
+ border: solid 1px #6C6;
+}
+
+#flash_error, #flash_alert {
+ background-color: #FCC;
+ border: solid 1px #C66;
+}
+
+.field_with_errors {
+ display: inline;
+}
+
+.error_messages {
+ width: 400px;
+ border: 2px solid #CF0000;
+ padding: 0px;
+ padding-bottom: 12px;
+ margin-bottom: 20px;
+ background-color: #f0f0f0;
+ font-size: 12px;
+}
+
+.error_messages h2 {
+ text-align: left;
+ font-weight: bold;
+ padding: 5px 10px;
+ font-size: 12px;
+ margin: 0;
+ background-color: #c00;
+ color: #fff;
+}
+
+.error_messages p {
+ margin: 8px 10px;
+}
+
+.error_messages ul {
+ margin-bottom: 0;
+}
+
+form .field, form .actions {
+ margin: 12px 0;
+}
View
32 episode-196/revised/questionnaire-before/app/assets/stylesheets/surveys.css.scss
@@ -0,0 +1,32 @@
+// Place all the styles related to the surveys controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+.article {
+ h2 {
+ font-size: 18px;
+ margin-top: 20px;
+ margin-bottom: 3px;
+ }
+}
+
+.questions {
+ list-style: none;
+ font-weight: bold;
+ margin: 0;
+ padding: 0;
+ > li {
+ margin: 20px 0;
+ padding: 0;
+ }
+}
+
+.answers {
+ list-style: upper-alpha;
+ font-weight: normal;
+ margin: 0;
+ padding: 0;
+ > li {
+ margin: 5px 0;
+ margin-left: 25px;
+ }
+}
View
0  ...app/controllers/application_controller.rb → ...app/controllers/application_controller.rb
File renamed without changes
View
41 episode-196/revised/questionnaire-before/app/controllers/surveys_controller.rb
@@ -0,0 +1,41 @@
+class SurveysController < ApplicationController
+ def index
+ @surveys = Survey.all
+ end
+
+ def show
+ @survey = Survey.find(params[:id])
+ end
+
+ def new
+ @survey = Survey.new
+ end
+
+ def create
+ @survey = Survey.new(params[:survey])
+ if @survey.save
+ redirect_to @survey, notice: "Successfully created survey."
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @survey = Survey.find(params[:id])
+ end
+
+ def update
+ @survey = Survey.find(params[:id])
+ if @survey.update_attributes(params[:survey])
+ redirect_to @survey, notice: "Successfully updated survey."
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @survey = Survey.find(params[:id])
+ @survey.destroy
+ redirect_to surveys_url, notice: "Successfully destroyed survey."
+ end
+end
View
0  ...-before/app/helpers/application_helper.rb → ...-before/app/helpers/application_helper.rb
File renamed without changes
View
2  episode-196/revised/questionnaire-before/app/helpers/surveys_helper.rb
@@ -0,0 +1,2 @@
+module SurveysHelper
+end
View
0  ...ised/mailer-after/vendor/plugins/.gitkeep → ...questionnaire-before/app/mailers/.gitkeep
File renamed without changes
View
0  ...-after/vendor/assets/stylesheets/.gitkeep → .../questionnaire-before/app/models/.gitkeep
File renamed without changes
View
4 episode-196/revised/questionnaire-before/app/models/answer.rb
@@ -0,0 +1,4 @@
+class Answer < ActiveRecord::Base
+ attr_accessible :content, :question_id
+ belongs_to :question
+end
View
5 episode-196/revised/questionnaire-before/app/models/question.rb
@@ -0,0 +1,5 @@
+class Question < ActiveRecord::Base
+ attr_accessible :content, :survey_id
+ belongs_to :survey
+ has_many :answers
+end
View
4 episode-196/revised/questionnaire-before/app/models/survey.rb
@@ -0,0 +1,4 @@
+class Survey < ActiveRecord::Base
+ attr_accessible :name
+ has_many :questions
+end
View
17 episode-196/revised/questionnaire-before/app/views/layouts/application.html.erb
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Questionnaire</title>
+ <%= stylesheet_link_tag "application", media: "all" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tag %>
+ </head>
+ <body>
+ <div id="container">
+ <% flash.each do |name, msg| %>
+ <%= content_tag :div, msg, id: "flash_#{name}" %>
+ <% end %>
+ <%= yield %>
+ </div>
+ </body>
+</html>
View
20 episode-196/revised/questionnaire-before/app/views/surveys/_form.html.erb
@@ -0,0 +1,20 @@
+<%= form_for @survey do |f| %>
+ <% if @survey.errors.any? %>
+ <div class="error_messages">
+ <h2><%= pluralize(@survey.errors.count, "error") %> prohibited this survey from being saved:</h2>
+ <ul>
+ <% @survey.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :name %><br />
+ <%= f.text_field :name %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
View
3  episode-196/revised/questionnaire-before/app/views/surveys/edit.html.erb
@@ -0,0 +1,3 @@
+<h1>Editing Survey</h1>
+
+<%= render "form" %>
View
10 episode-196/revised/questionnaire-before/app/views/surveys/index.html.erb
@@ -0,0 +1,10 @@
+<h1>Surveys</h1>
+
+<% @surveys.each do |survey| %>
+ <div class="article">
+ <h2><%= link_to survey.name, survey %></h2>
+ <%= pluralize(survey.questions.size, "Question") %>
+ </div>
+<% end %>
+
+<p><%= link_to 'New Survey', new_survey_path %></p>
View
3  episode-196/revised/questionnaire-before/app/views/surveys/new.html.erb
@@ -0,0 +1,3 @@
+<h1>New Survey</h1>
+
+<%= render "form" %>
View
17 episode-196/revised/questionnaire-before/app/views/surveys/show.html.erb
@@ -0,0 +1,17 @@
+<h1><%= @survey.name %></h1>
+
+<ol class="questions">
+<% @survey.questions.each do |question| %>
+ <li>
+ <%= question.content %>
+ <ol class="answers">
+ <% question.answers.each do |answer| %>
+ <li><%= answer.content %></li>
+ <% end %>
+ </ol>
+ </li>
+<% end %>
+</ol>
+
+<%= link_to 'Edit', edit_survey_path(@survey) %> |
+<%= link_to 'Back to Surveys', surveys_path %>
View
4 episode-196/revised/questionnaire-before/config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Questionnaire::Application
View
59 episode-196/revised/questionnaire-before/config/application.rb
@@ -0,0 +1,59 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+if defined?(Bundler)
+ # If you precompile assets before deploying to production, use this line
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
+ # If you want your assets lazily compiled in production, use this line
+ # Bundler.require(:default, :assets, Rails.env)
+end
+
+module Questionnaire
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Custom directories with classes and modules you want to be autoloadable.
+ # config.autoload_paths += %W(#{config.root}/extras)
+
+ # Only load the plugins named here, in the order given (default is alphabetical).
+ # :all can be used as a placeholder for all plugins not explicitly named.
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Activate observers that should always be running.
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # Configure the default encoding used in templates for Ruby 1.9.
+ config.encoding = "utf-8"
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters += [:password]
+
+ # Use SQL instead of Active Record's schema dumper when creating the database.
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
+
+ # Enforce whitelist mode for mass assignment.
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
+ # parameters by using an attr_accessible or attr_protected declaration.
+ config.active_record.whitelist_attributes = true
+
+ # Enable the asset pipeline
+ config.assets.enabled = true
+
+ # Version of your assets, change this if you want to expire all your assets
+ config.assets.version = '1.0'
+ end
+end
View
0  ...e-196/revised/mailer-after/config/boot.rb → ...vised/questionnaire-before/config/boot.rb
File renamed without changes
View
25 episode-196/revised/questionnaire-before/config/database.yml
@@ -0,0 +1,25 @@
+# SQLite version 3.x
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem 'sqlite3'
+development:
+ adapter: sqlite3
+ database: db/development.sqlite3
+ pool: 5
+ timeout: 5000
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ adapter: sqlite3
+ database: db/test.sqlite3
+ pool: 5
+ timeout: 5000
+
+production:
+ adapter: sqlite3
+ database: db/production.sqlite3
+ pool: 5
+ timeout: 5000
View
5 episode-196/revised/questionnaire-before/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Questionnaire::Application.initialize!
View
37 episode-196/revised/questionnaire-before/config/environments/development.rb
@@ -0,0 +1,37 @@
+Questionnaire::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.cache_classes = false
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger
+ config.active_support.deprecation = :log
+
+ # Only use best-standards-support built into browsers
+ config.action_dispatch.best_standards_support = :builtin
+
+ # Raise exception on mass assignment protection for Active Record models
+ config.active_record.mass_assignment_sanitizer = :strict
+
+ # Log the query plan for queries taking more than this (works
+ # with SQLite, MySQL, and PostgreSQL)
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
+
+ # Do not compress assets
+ config.assets.compress = false
+
+ # Expands the lines which load the assets
+ config.assets.debug = true
+end
View
67 episode-196/revised/questionnaire-before/config/environments/production.rb
@@ -0,0 +1,67 @@
+Questionnaire::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # Code is not reloaded between requests
+ config.cache_classes = true
+
+ # Full error reports are disabled and caching is turned on
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Disable Rails's static asset server (Apache or nginx will already do this)
+ config.serve_static_assets = false
+
+ # Compress JavaScripts and CSS
+ config.assets.compress = true
+
+ # Don't fallback to assets pipeline if a precompiled asset is missed
+ config.assets.compile = false
+
+ # Generate digests for assets URLs
+ config.assets.digest = true
+
+ # Defaults to Rails.root.join("public/assets")
+ # config.assets.manifest = YOUR_PATH
+
+ # Specifies the header that your server uses for sending files
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
+
+ # See everything in the log (default is :info)
+ # config.log_level = :debug
+
+ # Prepend all log lines with the following tags
+ # config.log_tags = [ :subdomain, :uuid ]
+
+ # Use a different logger for distributed setups
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
+
+ # Use a different cache store in production
+ # config.cache_store = :mem_cache_store
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
+ # config.action_controller.asset_host = "http://assets.example.com"
+
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)