Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding revised episode 258

  • Loading branch information...
commit 9073ecc788dfc7ee1823f24d8339e1ac3f6bf808 1 parent 4c1f6fb
Ryan Bates authored
Showing with 5,028 additions and 0 deletions.
  1. +5 −0 episode-258/revised/README.md
  2. +15 −0 episode-258/revised/bookstore-before/.gitignore
  3. +40 −0 episode-258/revised/bookstore-before/Gemfile
  4. +114 −0 episode-258/revised/bookstore-before/Gemfile.lock
  5. +9 −0 episode-258/revised/bookstore-before/README.rdoc
  6. +7 −0 episode-258/revised/bookstore-before/Rakefile
  7. BIN  episode-258/revised/bookstore-before/app/assets/images/rails.png
  8. +15 −0 episode-258/revised/bookstore-before/app/assets/javascripts/application.js
  9. +3 −0  episode-258/revised/bookstore-before/app/assets/javascripts/authors.js.coffee
  10. +3 −0  episode-258/revised/bookstore-before/app/assets/javascripts/books.js.coffee
  11. +13 −0 episode-258/revised/bookstore-before/app/assets/stylesheets/application.css
  12. +3 −0  episode-258/revised/bookstore-before/app/assets/stylesheets/authors.css.scss
  13. +3 −0  episode-258/revised/bookstore-before/app/assets/stylesheets/books.css.scss
  14. +79 −0 episode-258/revised/bookstore-before/app/assets/stylesheets/layout.css.scss
  15. +3 −0  episode-258/revised/bookstore-before/app/controllers/application_controller.rb
  16. +41 −0 episode-258/revised/bookstore-before/app/controllers/authors_controller.rb
  17. +41 −0 episode-258/revised/bookstore-before/app/controllers/books_controller.rb
  18. +2 −0  episode-258/revised/bookstore-before/app/helpers/application_helper.rb
  19. +2 −0  episode-258/revised/bookstore-before/app/helpers/authors_helper.rb
  20. +2 −0  episode-258/revised/bookstore-before/app/helpers/books_helper.rb
  21. 0  episode-258/revised/bookstore-before/app/mailers/.gitkeep
  22. 0  episode-258/revised/bookstore-before/app/models/.gitkeep
  23. +5 −0 episode-258/revised/bookstore-before/app/models/author.rb
  24. +4 −0 episode-258/revised/bookstore-before/app/models/authorship.rb
  25. +5 −0 episode-258/revised/bookstore-before/app/models/book.rb
  26. +20 −0 episode-258/revised/bookstore-before/app/views/authors/_form.html.erb
  27. +6 −0 episode-258/revised/bookstore-before/app/views/authors/edit.html.erb
  28. +23 −0 episode-258/revised/bookstore-before/app/views/authors/index.html.erb
  29. +5 −0 episode-258/revised/bookstore-before/app/views/authors/new.html.erb
  30. +10 −0 episode-258/revised/bookstore-before/app/views/authors/show.html.erb
  31. +20 −0 episode-258/revised/bookstore-before/app/views/books/_form.html.erb
  32. +3 −0  episode-258/revised/bookstore-before/app/views/books/edit.html.erb
  33. +21 −0 episode-258/revised/bookstore-before/app/views/books/index.html.erb
  34. +3 −0  episode-258/revised/bookstore-before/app/views/books/new.html.erb
  35. +19 −0 episode-258/revised/bookstore-before/app/views/books/show.html.erb
  36. +17 −0 episode-258/revised/bookstore-before/app/views/layouts/application.html.erb
  37. +4 −0 episode-258/revised/bookstore-before/config.ru
  38. +59 −0 episode-258/revised/bookstore-before/config/application.rb
  39. +6 −0 episode-258/revised/bookstore-before/config/boot.rb
  40. +25 −0 episode-258/revised/bookstore-before/config/database.yml
  41. +5 −0 episode-258/revised/bookstore-before/config/environment.rb
  42. +37 −0 episode-258/revised/bookstore-before/config/environments/development.rb
  43. +67 −0 episode-258/revised/bookstore-before/config/environments/production.rb
  44. +37 −0 episode-258/revised/bookstore-before/config/environments/test.rb
  45. +7 −0 episode-258/revised/bookstore-before/config/initializers/backtrace_silencers.rb
  46. +15 −0 episode-258/revised/bookstore-before/config/initializers/inflections.rb
  47. +5 −0 episode-258/revised/bookstore-before/config/initializers/mime_types.rb
  48. +7 −0 episode-258/revised/bookstore-before/config/initializers/secret_token.rb
  49. +8 −0 episode-258/revised/bookstore-before/config/initializers/session_store.rb
  50. +14 −0 episode-258/revised/bookstore-before/config/initializers/wrap_parameters.rb
  51. +5 −0 episode-258/revised/bookstore-before/config/locales/en.yml
  52. +5 −0 episode-258/revised/bookstore-before/config/routes.rb
  53. +9 −0 episode-258/revised/bookstore-before/db/migrate/20120504212612_create_books.rb
  54. +9 −0 episode-258/revised/bookstore-before/db/migrate/20120504212643_create_authors.rb
  55. +12 −0 episode-258/revised/bookstore-before/db/migrate/20120504212811_create_authorships.rb
  56. +38 −0 episode-258/revised/bookstore-before/db/schema.rb
  57. +6 −0 episode-258/revised/bookstore-before/db/seeds.rb
  58. +2 −0  episode-258/revised/bookstore-before/doc/README_FOR_APP
  59. 0  episode-258/revised/bookstore-before/lib/assets/.gitkeep
  60. 0  episode-258/revised/bookstore-before/lib/tasks/.gitkeep
  61. 0  episode-258/revised/bookstore-before/log/.gitkeep
  62. +26 −0 episode-258/revised/bookstore-before/public/404.html
  63. +26 −0 episode-258/revised/bookstore-before/public/422.html
  64. +25 −0 episode-258/revised/bookstore-before/public/500.html
  65. 0  episode-258/revised/bookstore-before/public/favicon.ico
  66. +5 −0 episode-258/revised/bookstore-before/public/robots.txt
  67. +6 −0 episode-258/revised/bookstore-before/script/rails
  68. 0  episode-258/revised/bookstore-before/test/fixtures/.gitkeep
  69. +7 −0 episode-258/revised/bookstore-before/test/fixtures/authors.yml
  70. +9 −0 episode-258/revised/bookstore-before/test/fixtures/authorships.yml
  71. +7 −0 episode-258/revised/bookstore-before/test/fixtures/books.yml
  72. 0  episode-258/revised/bookstore-before/test/functional/.gitkeep
  73. +49 −0 episode-258/revised/bookstore-before/test/functional/authors_controller_test.rb
  74. +49 −0 episode-258/revised/bookstore-before/test/functional/books_controller_test.rb
  75. 0  episode-258/revised/bookstore-before/test/integration/.gitkeep
  76. +12 −0 episode-258/revised/bookstore-before/test/performance/browsing_test.rb
  77. +13 −0 episode-258/revised/bookstore-before/test/test_helper.rb
  78. 0  episode-258/revised/bookstore-before/test/unit/.gitkeep
  79. +7 −0 episode-258/revised/bookstore-before/test/unit/author_test.rb
  80. +7 −0 episode-258/revised/bookstore-before/test/unit/authorship_test.rb
  81. +7 −0 episode-258/revised/bookstore-before/test/unit/book_test.rb
  82. +4 −0 episode-258/revised/bookstore-before/test/unit/helpers/authors_helper_test.rb
  83. +4 −0 episode-258/revised/bookstore-before/test/unit/helpers/books_helper_test.rb
  84. 0  episode-258/revised/bookstore-before/vendor/assets/javascripts/.gitkeep
  85. 0  episode-258/revised/bookstore-before/vendor/assets/stylesheets/.gitkeep
  86. 0  episode-258/revised/bookstore-before/vendor/plugins/.gitkeep
  87. +15 −0 episode-258/revised/bookstore-chosen-after/.gitignore
  88. +44 −0 episode-258/revised/bookstore-chosen-after/Gemfile
  89. +118 −0 episode-258/revised/bookstore-chosen-after/Gemfile.lock
  90. +9 −0 episode-258/revised/bookstore-chosen-after/README.rdoc
  91. +7 −0 episode-258/revised/bookstore-chosen-after/Rakefile
  92. BIN  episode-258/revised/bookstore-chosen-after/app/assets/images/rails.png
  93. +16 −0 episode-258/revised/bookstore-chosen-after/app/assets/javascripts/application.js
  94. +3 −0  episode-258/revised/bookstore-chosen-after/app/assets/javascripts/authors.js.coffee
  95. +5 −0 episode-258/revised/bookstore-chosen-after/app/assets/javascripts/books.js.coffee
  96. +14 −0 episode-258/revised/bookstore-chosen-after/app/assets/stylesheets/application.css
  97. +3 −0  episode-258/revised/bookstore-chosen-after/app/assets/stylesheets/authors.css.scss
  98. +6 −0 episode-258/revised/bookstore-chosen-after/app/assets/stylesheets/books.css.scss
  99. +79 −0 episode-258/revised/bookstore-chosen-after/app/assets/stylesheets/layout.css.scss
  100. +3 −0  episode-258/revised/bookstore-chosen-after/app/controllers/application_controller.rb
  101. +41 −0 episode-258/revised/bookstore-chosen-after/app/controllers/authors_controller.rb
  102. +41 −0 episode-258/revised/bookstore-chosen-after/app/controllers/books_controller.rb
  103. +2 −0  episode-258/revised/bookstore-chosen-after/app/helpers/application_helper.rb
  104. +2 −0  episode-258/revised/bookstore-chosen-after/app/helpers/authors_helper.rb
  105. +2 −0  episode-258/revised/bookstore-chosen-after/app/helpers/books_helper.rb
  106. 0  episode-258/revised/bookstore-chosen-after/app/mailers/.gitkeep
  107. 0  episode-258/revised/bookstore-chosen-after/app/models/.gitkeep
  108. +5 −0 episode-258/revised/bookstore-chosen-after/app/models/author.rb
  109. +4 −0 episode-258/revised/bookstore-chosen-after/app/models/authorship.rb
  110. +5 −0 episode-258/revised/bookstore-chosen-after/app/models/book.rb
  111. +20 −0 episode-258/revised/bookstore-chosen-after/app/views/authors/_form.html.erb
  112. +6 −0 episode-258/revised/bookstore-chosen-after/app/views/authors/edit.html.erb
  113. +23 −0 episode-258/revised/bookstore-chosen-after/app/views/authors/index.html.erb
  114. +5 −0 episode-258/revised/bookstore-chosen-after/app/views/authors/new.html.erb
  115. +10 −0 episode-258/revised/bookstore-chosen-after/app/views/authors/show.html.erb
  116. +24 −0 episode-258/revised/bookstore-chosen-after/app/views/books/_form.html.erb
  117. +3 −0  episode-258/revised/bookstore-chosen-after/app/views/books/edit.html.erb
  118. +21 −0 episode-258/revised/bookstore-chosen-after/app/views/books/index.html.erb
  119. +3 −0  episode-258/revised/bookstore-chosen-after/app/views/books/new.html.erb
  120. +19 −0 episode-258/revised/bookstore-chosen-after/app/views/books/show.html.erb
  121. +17 −0 episode-258/revised/bookstore-chosen-after/app/views/layouts/application.html.erb
  122. +4 −0 episode-258/revised/bookstore-chosen-after/config.ru
  123. +59 −0 episode-258/revised/bookstore-chosen-after/config/application.rb
  124. +6 −0 episode-258/revised/bookstore-chosen-after/config/boot.rb
  125. +25 −0 episode-258/revised/bookstore-chosen-after/config/database.yml
  126. +5 −0 episode-258/revised/bookstore-chosen-after/config/environment.rb
  127. +37 −0 episode-258/revised/bookstore-chosen-after/config/environments/development.rb
  128. +67 −0 episode-258/revised/bookstore-chosen-after/config/environments/production.rb
  129. +37 −0 episode-258/revised/bookstore-chosen-after/config/environments/test.rb
  130. +7 −0 episode-258/revised/bookstore-chosen-after/config/initializers/backtrace_silencers.rb
  131. +15 −0 episode-258/revised/bookstore-chosen-after/config/initializers/inflections.rb
  132. +5 −0 episode-258/revised/bookstore-chosen-after/config/initializers/mime_types.rb
  133. +7 −0 episode-258/revised/bookstore-chosen-after/config/initializers/secret_token.rb
  134. +8 −0 episode-258/revised/bookstore-chosen-after/config/initializers/session_store.rb
  135. +14 −0 episode-258/revised/bookstore-chosen-after/config/initializers/wrap_parameters.rb
  136. +5 −0 episode-258/revised/bookstore-chosen-after/config/locales/en.yml
  137. +5 −0 episode-258/revised/bookstore-chosen-after/config/routes.rb
  138. +9 −0 episode-258/revised/bookstore-chosen-after/db/migrate/20120504212612_create_books.rb
  139. +9 −0 episode-258/revised/bookstore-chosen-after/db/migrate/20120504212643_create_authors.rb
  140. +12 −0 episode-258/revised/bookstore-chosen-after/db/migrate/20120504212811_create_authorships.rb
  141. +38 −0 episode-258/revised/bookstore-chosen-after/db/schema.rb
  142. +6 −0 episode-258/revised/bookstore-chosen-after/db/seeds.rb
  143. +2 −0  episode-258/revised/bookstore-chosen-after/doc/README_FOR_APP
  144. 0  episode-258/revised/bookstore-chosen-after/lib/assets/.gitkeep
  145. 0  episode-258/revised/bookstore-chosen-after/lib/tasks/.gitkeep
  146. 0  episode-258/revised/bookstore-chosen-after/log/.gitkeep
  147. +26 −0 episode-258/revised/bookstore-chosen-after/public/404.html
  148. +26 −0 episode-258/revised/bookstore-chosen-after/public/422.html
  149. +25 −0 episode-258/revised/bookstore-chosen-after/public/500.html
  150. 0  episode-258/revised/bookstore-chosen-after/public/favicon.ico
  151. +5 −0 episode-258/revised/bookstore-chosen-after/public/robots.txt
  152. +6 −0 episode-258/revised/bookstore-chosen-after/script/rails
  153. 0  episode-258/revised/bookstore-chosen-after/test/fixtures/.gitkeep
  154. +7 −0 episode-258/revised/bookstore-chosen-after/test/fixtures/authors.yml
  155. +9 −0 episode-258/revised/bookstore-chosen-after/test/fixtures/authorships.yml
  156. +7 −0 episode-258/revised/bookstore-chosen-after/test/fixtures/books.yml
  157. 0  episode-258/revised/bookstore-chosen-after/test/functional/.gitkeep
  158. +49 −0 episode-258/revised/bookstore-chosen-after/test/functional/authors_controller_test.rb
  159. +49 −0 episode-258/revised/bookstore-chosen-after/test/functional/books_controller_test.rb
  160. 0  episode-258/revised/bookstore-chosen-after/test/integration/.gitkeep
  161. +12 −0 episode-258/revised/bookstore-chosen-after/test/performance/browsing_test.rb
  162. +13 −0 episode-258/revised/bookstore-chosen-after/test/test_helper.rb
  163. 0  episode-258/revised/bookstore-chosen-after/test/unit/.gitkeep
  164. +7 −0 episode-258/revised/bookstore-chosen-after/test/unit/author_test.rb
  165. +7 −0 episode-258/revised/bookstore-chosen-after/test/unit/authorship_test.rb
  166. +7 −0 episode-258/revised/bookstore-chosen-after/test/unit/book_test.rb
  167. +4 −0 episode-258/revised/bookstore-chosen-after/test/unit/helpers/authors_helper_test.rb
  168. +4 −0 episode-258/revised/bookstore-chosen-after/test/unit/helpers/books_helper_test.rb
  169. 0  episode-258/revised/bookstore-chosen-after/vendor/assets/javascripts/.gitkeep
  170. 0  episode-258/revised/bookstore-chosen-after/vendor/assets/stylesheets/.gitkeep
  171. 0  episode-258/revised/bookstore-chosen-after/vendor/plugins/.gitkeep
  172. +15 −0 episode-258/revised/bookstore-tokeninput-after/.gitignore
  173. +40 −0 episode-258/revised/bookstore-tokeninput-after/Gemfile
  174. +114 −0 episode-258/revised/bookstore-tokeninput-after/Gemfile.lock
  175. +9 −0 episode-258/revised/bookstore-tokeninput-after/README.rdoc
  176. +7 −0 episode-258/revised/bookstore-tokeninput-after/Rakefile
  177. BIN  episode-258/revised/bookstore-tokeninput-after/app/assets/images/rails.png
  178. +16 −0 episode-258/revised/bookstore-tokeninput-after/app/assets/javascripts/application.js
  179. +3 −0  episode-258/revised/bookstore-tokeninput-after/app/assets/javascripts/authors.js.coffee
  180. +7 −0 episode-258/revised/bookstore-tokeninput-after/app/assets/javascripts/books.js.coffee
  181. +14 −0 episode-258/revised/bookstore-tokeninput-after/app/assets/stylesheets/application.css
  182. +3 −0  episode-258/revised/bookstore-tokeninput-after/app/assets/stylesheets/authors.css.scss
  183. +3 −0  episode-258/revised/bookstore-tokeninput-after/app/assets/stylesheets/books.css.scss
  184. +79 −0 episode-258/revised/bookstore-tokeninput-after/app/assets/stylesheets/layout.css.scss
  185. +3 −0  episode-258/revised/bookstore-tokeninput-after/app/controllers/application_controller.rb
  186. +45 −0 episode-258/revised/bookstore-tokeninput-after/app/controllers/authors_controller.rb
  187. +41 −0 episode-258/revised/bookstore-tokeninput-after/app/controllers/books_controller.rb
  188. +2 −0  episode-258/revised/bookstore-tokeninput-after/app/helpers/application_helper.rb
  189. +2 −0  episode-258/revised/bookstore-tokeninput-after/app/helpers/authors_helper.rb
  190. +2 −0  episode-258/revised/bookstore-tokeninput-after/app/helpers/books_helper.rb
  191. 0  episode-258/revised/bookstore-tokeninput-after/app/mailers/.gitkeep
  192. 0  episode-258/revised/bookstore-tokeninput-after/app/models/.gitkeep
  193. +19 −0 episode-258/revised/bookstore-tokeninput-after/app/models/author.rb
  194. +4 −0 episode-258/revised/bookstore-tokeninput-after/app/models/authorship.rb
  195. +10 −0 episode-258/revised/bookstore-tokeninput-after/app/models/book.rb
  196. +20 −0 episode-258/revised/bookstore-tokeninput-after/app/views/authors/_form.html.erb
  197. +6 −0 episode-258/revised/bookstore-tokeninput-after/app/views/authors/edit.html.erb
  198. +23 −0 episode-258/revised/bookstore-tokeninput-after/app/views/authors/index.html.erb
  199. +5 −0 episode-258/revised/bookstore-tokeninput-after/app/views/authors/new.html.erb
  200. +10 −0 episode-258/revised/bookstore-tokeninput-after/app/views/authors/show.html.erb
  201. +24 −0 episode-258/revised/bookstore-tokeninput-after/app/views/books/_form.html.erb
  202. +3 −0  episode-258/revised/bookstore-tokeninput-after/app/views/books/edit.html.erb
  203. +21 −0 episode-258/revised/bookstore-tokeninput-after/app/views/books/index.html.erb
  204. +3 −0  episode-258/revised/bookstore-tokeninput-after/app/views/books/new.html.erb
  205. +19 −0 episode-258/revised/bookstore-tokeninput-after/app/views/books/show.html.erb
  206. +17 −0 episode-258/revised/bookstore-tokeninput-after/app/views/layouts/application.html.erb
  207. +4 −0 episode-258/revised/bookstore-tokeninput-after/config.ru
  208. +59 −0 episode-258/revised/bookstore-tokeninput-after/config/application.rb
  209. +6 −0 episode-258/revised/bookstore-tokeninput-after/config/boot.rb
  210. +25 −0 episode-258/revised/bookstore-tokeninput-after/config/database.yml
  211. +5 −0 episode-258/revised/bookstore-tokeninput-after/config/environment.rb
  212. +37 −0 episode-258/revised/bookstore-tokeninput-after/config/environments/development.rb
  213. +67 −0 episode-258/revised/bookstore-tokeninput-after/config/environments/production.rb
  214. +37 −0 episode-258/revised/bookstore-tokeninput-after/config/environments/test.rb
  215. +7 −0 episode-258/revised/bookstore-tokeninput-after/config/initializers/backtrace_silencers.rb
  216. +15 −0 episode-258/revised/bookstore-tokeninput-after/config/initializers/inflections.rb
  217. +5 −0 episode-258/revised/bookstore-tokeninput-after/config/initializers/mime_types.rb
  218. +7 −0 episode-258/revised/bookstore-tokeninput-after/config/initializers/secret_token.rb
  219. +8 −0 episode-258/revised/bookstore-tokeninput-after/config/initializers/session_store.rb
  220. +14 −0 episode-258/revised/bookstore-tokeninput-after/config/initializers/wrap_parameters.rb
  221. +5 −0 episode-258/revised/bookstore-tokeninput-after/config/locales/en.yml
  222. +5 −0 episode-258/revised/bookstore-tokeninput-after/config/routes.rb
  223. +9 −0 episode-258/revised/bookstore-tokeninput-after/db/migrate/20120504212612_create_books.rb
  224. +9 −0 episode-258/revised/bookstore-tokeninput-after/db/migrate/20120504212643_create_authors.rb
  225. +12 −0 episode-258/revised/bookstore-tokeninput-after/db/migrate/20120504212811_create_authorships.rb
  226. +38 −0 episode-258/revised/bookstore-tokeninput-after/db/schema.rb
  227. +6 −0 episode-258/revised/bookstore-tokeninput-after/db/seeds.rb
  228. +2 −0  episode-258/revised/bookstore-tokeninput-after/doc/README_FOR_APP
  229. 0  episode-258/revised/bookstore-tokeninput-after/lib/assets/.gitkeep
  230. 0  episode-258/revised/bookstore-tokeninput-after/lib/tasks/.gitkeep
  231. 0  episode-258/revised/bookstore-tokeninput-after/log/.gitkeep
  232. +26 −0 episode-258/revised/bookstore-tokeninput-after/public/404.html
  233. +26 −0 episode-258/revised/bookstore-tokeninput-after/public/422.html
  234. +25 −0 episode-258/revised/bookstore-tokeninput-after/public/500.html
  235. 0  episode-258/revised/bookstore-tokeninput-after/public/favicon.ico
  236. +5 −0 episode-258/revised/bookstore-tokeninput-after/public/robots.txt
  237. +6 −0 episode-258/revised/bookstore-tokeninput-after/script/rails
  238. 0  episode-258/revised/bookstore-tokeninput-after/test/fixtures/.gitkeep
  239. +7 −0 episode-258/revised/bookstore-tokeninput-after/test/fixtures/authors.yml
  240. +9 −0 episode-258/revised/bookstore-tokeninput-after/test/fixtures/authorships.yml
  241. +7 −0 episode-258/revised/bookstore-tokeninput-after/test/fixtures/books.yml
  242. 0  episode-258/revised/bookstore-tokeninput-after/test/functional/.gitkeep
  243. +49 −0 episode-258/revised/bookstore-tokeninput-after/test/functional/authors_controller_test.rb
  244. +49 −0 episode-258/revised/bookstore-tokeninput-after/test/functional/books_controller_test.rb
  245. 0  episode-258/revised/bookstore-tokeninput-after/test/integration/.gitkeep
  246. +12 −0 episode-258/revised/bookstore-tokeninput-after/test/performance/browsing_test.rb
  247. +13 −0 episode-258/revised/bookstore-tokeninput-after/test/test_helper.rb
  248. 0  episode-258/revised/bookstore-tokeninput-after/test/unit/.gitkeep
  249. +7 −0 episode-258/revised/bookstore-tokeninput-after/test/unit/author_test.rb
  250. +7 −0 episode-258/revised/bookstore-tokeninput-after/test/unit/authorship_test.rb
  251. +7 −0 episode-258/revised/bookstore-tokeninput-after/test/unit/book_test.rb
  252. +4 −0 episode-258/revised/bookstore-tokeninput-after/test/unit/helpers/authors_helper_test.rb
  253. +4 −0 episode-258/revised/bookstore-tokeninput-after/test/unit/helpers/books_helper_test.rb
  254. 0  episode-258/revised/bookstore-tokeninput-after/vendor/assets/javascripts/.gitkeep
  255. +915 −0 episode-258/revised/bookstore-tokeninput-after/vendor/assets/javascripts/jquery.tokeninput.js
  256. 0  episode-258/revised/bookstore-tokeninput-after/vendor/assets/stylesheets/.gitkeep
  257. +122 −0 episode-258/revised/bookstore-tokeninput-after/vendor/assets/stylesheets/token-input-facebook.css
  258. +204 −0 episode-258/revised/bookstore-tokeninput-after/vendor/assets/stylesheets/token-input-mac.css
  259. +127 −0 episode-258/revised/bookstore-tokeninput-after/vendor/assets/stylesheets/token-input.css
  260. 0  episode-258/revised/bookstore-tokeninput-after/vendor/plugins/.gitkeep
5 episode-258/revised/README.md
View
@@ -0,0 +1,5 @@
+# RailsCasts Episode #258: Token Fields (revised)
+
+http://railscasts.com/episodes/258-token-fields-revised
+
+Requires Ruby 1.9.2 or higher.
15 episode-258/revised/bookstore-before/.gitignore
View
@@ -0,0 +1,15 @@
+# See http://help.github.com/ignore-files/ for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile ~/.gitignore_global
+
+# Ignore bundler config
+/.bundle
+
+# Ignore the default SQLite database.
+/db/*.sqlite3
+
+# Ignore all logfiles and tempfiles.
+/log/*.log
+/tmp
40 episode-258/revised/bookstore-before/Gemfile
View
@@ -0,0 +1,40 @@
+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'
+
+gem 'faker', group: :development
+
+# 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'
114 episode-258/revised/bookstore-before/Gemfile.lock
View
@@ -0,0 +1,114 @@
+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.1)
+ multi_json (~> 1.0)
+ faker (1.0.1)
+ i18n (~> 0.4)
+ 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.7.0)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.18)
+ multi_json (1.3.4)
+ 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.16)
+ sass-rails (3.2.5)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ sprockets (2.1.3)
+ 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)
+ faker
+ jquery-rails
+ rails (= 3.2.3)
+ sass-rails (~> 3.2.3)
+ sqlite3
+ uglifier (>= 1.0.3)
9 episode-258/revised/bookstore-before/README.rdoc
View
@@ -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.
7 episode-258/revised/bookstore-before/Rakefile
View
@@ -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__)
+
+Bookstore::Application.load_tasks
BIN  episode-258/revised/bookstore-before/app/assets/images/rails.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 episode-258/revised/bookstore-before/app/assets/javascripts/application.js
View
@@ -0,0 +1,15 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+// GO AFTER THE REQUIRES BELOW.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
3  episode-258/revised/bookstore-before/app/assets/javascripts/authors.js.coffee
View
@@ -0,0 +1,3 @@
+# 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/
3  episode-258/revised/bookstore-before/app/assets/javascripts/books.js.coffee
View
@@ -0,0 +1,3 @@
+# 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/
13 episode-258/revised/bookstore-before/app/assets/stylesheets/application.css
View
@@ -0,0 +1,13 @@
+/*
+ * 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 .
+*/
3  episode-258/revised/bookstore-before/app/assets/stylesheets/authors.css.scss
View
@@ -0,0 +1,3 @@
+// Place all the styles related to the authors controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
3  episode-258/revised/bookstore-before/app/assets/stylesheets/books.css.scss
View
@@ -0,0 +1,3 @@
+// Place all the styles related to the books controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
79 episode-258/revised/bookstore-before/app/assets/stylesheets/layout.css.scss
View
@@ -0,0 +1,79 @@
+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;
+}
3  episode-258/revised/bookstore-before/app/controllers/application_controller.rb
View
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
41 episode-258/revised/bookstore-before/app/controllers/authors_controller.rb
View
@@ -0,0 +1,41 @@
+class AuthorsController < ApplicationController
+ def index
+ @authors = Author.order(:name)
+ end
+
+ def show
+ @author = Author.find(params[:id])
+ end
+
+ def new
+ @author = Author.new
+ end
+
+ def create
+ @author = Author.new(params[:author])
+ if @author.save
+ redirect_to @author, notice: "Successfully created author."
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @author = Author.find(params[:id])
+ end
+
+ def update
+ @author = Author.find(params[:id])
+ if @author.update_attributes(params[:author])
+ redirect_to @author, notice: "Successfully updated author."
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @author = Author.find(params[:id])
+ @author.destroy
+ redirect_to authors_url, notice: "Successfully destroyed author."
+ end
+end
41 episode-258/revised/bookstore-before/app/controllers/books_controller.rb
View
@@ -0,0 +1,41 @@
+class BooksController < ApplicationController
+ def index
+ @books = Book.all
+ end
+
+ def show
+ @book = Book.find(params[:id])
+ end
+
+ def new
+ @book = Book.new
+ end
+
+ def create
+ @book = Book.new(params[:book])
+ if @book.save
+ redirect_to @book, notice: "Successfully created book."
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @book = Book.find(params[:id])
+ end
+
+ def update
+ @book = Book.find(params[:id])
+ if @book.update_attributes(params[:book])
+ redirect_to @book, notice: "Successfully updated book."
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @book = Book.find(params[:id])
+ @book.destroy
+ redirect_to books_url, notice: "Successfully destroyed book."
+ end
+end
2  episode-258/revised/bookstore-before/app/helpers/application_helper.rb
View
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
2  episode-258/revised/bookstore-before/app/helpers/authors_helper.rb
View
@@ -0,0 +1,2 @@
+module AuthorsHelper
+end
2  episode-258/revised/bookstore-before/app/helpers/books_helper.rb
View
@@ -0,0 +1,2 @@
+module BooksHelper
+end
0  episode-258/revised/bookstore-before/app/mailers/.gitkeep
View
No changes.
0  episode-258/revised/bookstore-before/app/models/.gitkeep
View
No changes.
5 episode-258/revised/bookstore-before/app/models/author.rb
View
@@ -0,0 +1,5 @@
+class Author < ActiveRecord::Base
+ attr_accessible :name
+ has_many :authorships
+ has_many :books, through: :authorships
+end
4 episode-258/revised/bookstore-before/app/models/authorship.rb
View
@@ -0,0 +1,4 @@
+class Authorship < ActiveRecord::Base
+ belongs_to :book
+ belongs_to :author
+end
5 episode-258/revised/bookstore-before/app/models/book.rb
View
@@ -0,0 +1,5 @@
+class Book < ActiveRecord::Base
+ attr_accessible :name
+ has_many :authorships
+ has_many :authors, through: :authorships
+end
20 episode-258/revised/bookstore-before/app/views/authors/_form.html.erb
View
@@ -0,0 +1,20 @@
+<%= form_for(@author) do |f| %>
+ <% if @author.errors.any? %>
+ <div class="error_messages">
+ <h2><%= pluralize(@author.errors.count, "error") %> prohibited this author from being saved:</h2>
+ <ul>
+ <% @author.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 %>
6 episode-258/revised/bookstore-before/app/views/authors/edit.html.erb
View
@@ -0,0 +1,6 @@
+<h1>Editing author</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @author %> |
+<%= link_to 'Back', authors_path %>
23 episode-258/revised/bookstore-before/app/views/authors/index.html.erb
View
@@ -0,0 +1,23 @@
+<h1>Listing authors</h1>
+
+<table>
+ <tr>
+ <th>Name</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @authors.each do |author| %>
+ <tr>
+ <td><%= author.name %></td>
+ <td><%= link_to 'Show', author %></td>
+ <td><%= link_to 'Edit', edit_author_path(author) %></td>
+ <td><%= link_to 'Destroy', author, confirm: 'Are you sure?', method: :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New Author', new_author_path %>
5 episode-258/revised/bookstore-before/app/views/authors/new.html.erb
View
@@ -0,0 +1,5 @@
+<h1>New Author</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', authors_path %>
10 episode-258/revised/bookstore-before/app/views/authors/show.html.erb
View
@@ -0,0 +1,10 @@
+<h1>Author</h1>
+
+<p>
+ <b>Name:</b>
+ <%= @author.name %>
+</p>
+
+
+<%= link_to 'Edit', edit_author_path(@author) %> |
+<%= link_to 'Back', authors_path %>
20 episode-258/revised/bookstore-before/app/views/books/_form.html.erb
View
@@ -0,0 +1,20 @@
+<%= form_for(@book) do |f| %>
+ <% if @book.errors.any? %>
+ <div class="error_messages">
+ <h2><%= pluralize(@book.errors.count, "error") %> prohibited this book from being saved:</h2>
+ <ul>
+ <% @book.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 %>
3  episode-258/revised/bookstore-before/app/views/books/edit.html.erb
View
@@ -0,0 +1,3 @@
+<h1>Editing Book</h1>
+
+<%= render 'form' %>
21 episode-258/revised/bookstore-before/app/views/books/index.html.erb
View
@@ -0,0 +1,21 @@
+<h1>Books</h1>
+
+<% if @books.empty? %>
+ <strong>Currently no books.</strong>
+<% else %>
+<table>
+ <tr>
+ <th>Name</th>
+ </tr>
+ <% @books.each do |book| %>
+ <tr>
+ <td><%= book.name %></td>
+ <td><%= link_to "Show", book %></td>
+ <td><%= link_to "Edit", edit_book_path(book) %></td>
+ <td><%= link_to "Destroy", book, confirm: 'Are you sure?', method: :delete %></td>
+ </tr>
+ <% end %>
+</table>
+<% end %>
+
+<p><%= link_to "New Book", new_book_path %></p>
3  episode-258/revised/bookstore-before/app/views/books/new.html.erb
View
@@ -0,0 +1,3 @@
+<h1>New Book</h1>
+
+<%= render 'form' %>
19 episode-258/revised/bookstore-before/app/views/books/show.html.erb
View
@@ -0,0 +1,19 @@
+<h1>Book</h1>
+
+<p>
+ <strong>Name:</strong>
+ <%= @book.name %>
+</p>
+
+<strong>Authors:</strong>
+<ul>
+<% @book.authors.each do |author| %>
+ <li><%= author.name %></li>
+<% end %>
+</ul>
+
+<p>
+ <%= link_to "Edit", edit_book_path(@book) %> |
+ <%= link_to "Destroy", @book, :confirm => 'Are you sure?', :method => :delete %> |
+ <%= link_to "View All", books_path %>
+</p>
17 episode-258/revised/bookstore-before/app/views/layouts/application.html.erb
View
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Bookstore</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>
4 episode-258/revised/bookstore-before/config.ru
View
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Bookstore::Application
59 episode-258/revised/bookstore-before/config/application.rb
View
@@ -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 Bookstore
+ 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
6 episode-258/revised/bookstore-before/config/boot.rb
View
@@ -0,0 +1,6 @@
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
25 episode-258/revised/bookstore-before/config/database.yml
View
@@ -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
5 episode-258/revised/bookstore-before/config/environment.rb
View
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Bookstore::Application.initialize!
37 episode-258/revised/bookstore-before/config/environments/development.rb
View
@@ -0,0 +1,37 @@
+Bookstore::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
67 episode-258/revised/bookstore-before/config/environments/production.rb
View
@@ -0,0 +1,67 @@
+Bookstore::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
37 episode-258/revised/bookstore-before/config/environments/test.rb
View
@@ -0,0 +1,37 @@
+Bookstore::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
7 episode-258/revised/bookstore-before/config/initializers/backtrace_silencers.rb
View
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
15 episode-258/revised/bookstore-before/config/initializers/inflections.rb
View
@@ -0,0 +1,15 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format
+# (all these examples are active by default):
+# ActiveSupport::Inflector.inflections do |inflect|
+# inflect.plural /^(ox)$/i, '\1en'
+# inflect.singular /^(ox)en/i, '\1'
+# inflect.irregular 'person', 'people'
+# inflect.uncountable %w( fish sheep )
+# end
+#
+# These inflection rules are supported but not enabled by default:
+# ActiveSupport::Inflector.inflections do |inflect|
+# inflect.acronym 'RESTful'
+# end
5 episode-258/revised/bookstore-before/config/initializers/mime_types.rb
View
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
+# Mime::Type.register_alias "text/html", :iphone
7 episode-258/revised/bookstore-before/config/initializers/secret_token.rb
View
@@ -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.
+Bookstore::Application.config.secret_token = 'ea58f0e4e941231c665873f36d12cfc4a6e22465a761d014a2af3e96b8a3c87b134d2aa29f043fee0602173e5af71636c3622b01fee69512a2d255157a514cb4'
8 episode-258/revised/bookstore-before/config/initializers/session_store.rb
View
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+Bookstore::Application.config.session_store :cookie_store, key: '_bookstore_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")
+# Bookstore::Application.config.session_store :active_record_store
14 episode-258/revised/bookstore-before/config/initializers/wrap_parameters.rb
View
@@ -0,0 +1,14 @@
+# Be sure to restart your server when you modify this file.
+#
+# This file contains settings for ActionController::ParamsWrapper which
+# is enabled by default.
+
+# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
+ActiveSupport.on_load(:action_controller) do
+ wrap_parameters format: [:json]
+end
+
+# Disable root element in JSON by default.
+ActiveSupport.on_load(:active_record) do
+ self.include_root_in_json = false
+end
5 episode-258/revised/bookstore-before/config/locales/en.yml
View
@@ -0,0 +1,5 @@
+# Sample localization file for English. Add more files in this directory for other locales.
+# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
+
+en:
+ hello: "Hello world"
5 episode-258/revised/bookstore-before/config/routes.rb
View
@@ -0,0 +1,5 @@
+Bookstore::Application.routes.draw do
+ resources :authors
+ resources :books
+ root to: 'books#index'
+end
9 episode-258/revised/bookstore-before/db/migrate/20120504212612_create_books.rb
View
@@ -0,0 +1,9 @@
+class CreateBooks < ActiveRecord::Migration
+ def change
+ create_table :books do |t|
+ t.string :name
+
+ t.timestamps
+ end
+ end
+end
9 episode-258/revised/bookstore-before/db/migrate/20120504212643_create_authors.rb
View
@@ -0,0 +1,9 @@
+class CreateAuthors < ActiveRecord::Migration
+ def change
+ create_table :authors do |t|
+ t.string :name
+
+ t.timestamps
+ end
+ end
+end
12 episode-258/revised/bookstore-before/db/migrate/20120504212811_create_authorships.rb
View
@@ -0,0 +1,12 @@
+class CreateAuthorships < ActiveRecord::Migration
+ def change
+ create_table :authorships do |t|
+ t.belongs_to :book
+ t.belongs_to :author
+
+ t.timestamps
+ end
+ add_index :authorships, :book_id
+ add_index :authorships, :author_id
+ end
+end
38 episode-258/revised/bookstore-before/db/schema.rb
View
@@ -0,0 +1,38 @@
+# 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 => 20120504212811) do
+
+ create_table "authors", :force => true do |t|
+ t.string "name"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "authorships", :force => true do |t|
+ t.integer "book_id"
+ t.integer "author_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "authorships", ["author_id"], :name => "index_authorships_on_author_id"
+ add_index "authorships", ["book_id"], :name => "index_authorships_on_book_id"
+
+ create_table "books", :force => true do |t|
+ t.string "name"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+end
6 episode-258/revised/bookstore-before/db/seeds.rb
View
@@ -0,0 +1,6 @@
+200.times do
+ Author.create!(name: Faker::Name.name)
+end
+["Erich Gamma", "Richard Helm", "Ralph Johnson", "John M. Vlissides"].each do |name|
+ Author.create!(name: name)
+end
2  episode-258/revised/bookstore-before/doc/README_FOR_APP
View
@@ -0,0 +1,2 @@
+Use this README file to introduce your application and point to useful places in the API for learning more.
+Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
0  episode-258/revised/bookstore-before/lib/assets/.gitkeep
View
No changes.
0  episode-258/revised/bookstore-before/lib/tasks/.gitkeep
View
No changes.
0  episode-258/revised/bookstore-before/log/.gitkeep
View
No changes.
26 episode-258/revised/bookstore-before/public/404.html
View
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The page you were looking for doesn't exist (404)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/404.html -->
+ <div class="dialog">
+ <h1>The page you were looking for doesn't exist.</h1>
+ <p>You may have mistyped the address or the page may have moved.</p>
+ </div>
+</body>
+</html>
26 episode-258/revised/bookstore-before/public/422.html
View
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The change you wanted was rejected (422)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/422.html -->
+ <div class="dialog">
+ <h1>The change you wanted was rejected.</h1>
+ <p>Maybe you tried to change something you didn't have access to.</p>
+ </div>
+</body>
+</html>
25 episode-258/revised/bookstore-before/public/500.html
View
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>We're sorry, but something went wrong (500)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/500.html -->
+ <div class="dialog">
+ <h1>We're sorry, but something went wrong.</h1>
+ </div>
+</body>
+</html>
0  episode-258/revised/bookstore-before/public/favicon.ico
View
No changes.
5 episode-258/revised/bookstore-before/public/robots.txt
View
@@ -0,0 +1,5 @@
+# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
+#
+# To ban all spiders from the entire site uncomment the next two lines:
+# User-Agent: *
+# Disallow: /
6 episode-258/revised/bookstore-before/script/rails
View
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
+
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require File.expand_path('../../config/boot', __FILE__)
+require 'rails/commands'
0  episode-258/revised/bookstore-before/test/fixtures/.gitkeep
View
No changes.
7 episode-258/revised/bookstore-before/test/fixtures/authors.yml
View
@@ -0,0 +1,7 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ name: MyString
+
+two:
+ name: MyString
9 episode-258/revised/bookstore-before/test/fixtures/authorships.yml
View
@@ -0,0 +1,9 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ book:
+ author:
+
+two:
+ book:
+ author:
7 episode-258/revised/bookstore-before/test/fixtures/books.yml
View
@@ -0,0 +1,7 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ name: MyString
+
+two:
+ name: MyString
0  episode-258/revised/bookstore-before/test/functional/.gitkeep
View
No changes.
49 episode-258/revised/bookstore-before/test/functional/authors_controller_test.rb
View
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class AuthorsControllerTest < ActionController::TestCase
+ setup do
+ @author = authors(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:authors)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create author" do
+ assert_difference('Author.count') do
+ post :create, author: { name: @author.name }
+ end
+
+ assert_redirected_to author_path(assigns(:author))
+ end
+
+ test "should show author" do
+ get :show, id: @author
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @author
+ assert_response :success
+ end
+
+ test "should update author" do
+ put :update, id: @author, author: { name: @author.name }
+ assert_redirected_to author_path(assigns(:author))
+ end
+
+ test "should destroy author" do
+ assert_difference('Author.count', -1) do
+ delete :destroy, id: @author
+ end
+
+ assert_redirected_to authors_path
+ end
+end
49 episode-258/revised/bookstore-before/test/functional/books_controller_test.rb
View
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class BooksControllerTest < ActionController::TestCase
+ setup do
+ @book = books(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:books)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create book" do
+ assert_difference('Book.count') do
+ post :create, book: { name: @book.name }
+ end
+
+ assert_redirected_to book_path(assigns(:book))
+ end
+
+ test "should show book" do
+ get :show, id: @book
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @book
+ assert_response :success
+ end
+
+ test "should update book" do
+ put :update, id: @book, book: { name: @book.name }
+ assert_redirected_to book_path(assigns(:book))
+ end
+
+ test "should destroy book" do
+ assert_difference('Book.count', -1) do
+ delete :destroy, id: @book
+ end
+
+ assert_redirected_to books_path
+ end
+end
0  episode-258/revised/bookstore-before/test/integration/.gitkeep
View
No changes.
12 episode-258/revised/bookstore-before/test/performance/browsing_test.rb
View
@@ -0,0 +1,12 @@
+require 'test_helper'
+require 'rails/performance_test_help'
+
+class BrowsingTest < ActionDispatch::PerformanceTest
+ # Refer to the documentation for all available options
+ # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
+ # :output => 'tmp/performance', :formats => [:flat] }
+
+ def test_homepage
+ get '/'
+ end
+end
13 episode-258/revised/bookstore-before/test/test_helper.rb
View
@@ -0,0 +1,13 @@
+ENV["RAILS_ENV"] = "test"
+require File.expand_path('../../config/environment', __FILE__)
+require 'rails/test_help'
+
+class ActiveSupport::TestCase
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
+ #
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
+ # -- they do not yet inherit this setting
+ fixtures :all
+
+ # Add more helper methods to be used by all tests here...
+end
0  episode-258/revised/bookstore-before/test/unit/.gitkeep
View
No changes.
7 episode-258/revised/bookstore-before/test/unit/author_test.rb
View
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class AuthorTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
7 episode-258/revised/bookstore-before/test/unit/authorship_test.rb
View
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class AuthorshipTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
7 episode-258/revised/bookstore-before/test/unit/book_test.rb
View
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class BookTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
4 episode-258/revised/bookstore-before/test/unit/helpers/authors_helper_test.rb
View
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class AuthorsHelperTest < ActionView::TestCase
+end
4 episode-258/revised/bookstore-before/test/unit/helpers/books_helper_test.rb
View
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class BooksHelperTest < ActionView::TestCase
+end
0  episode-258/revised/bookstore-before/vendor/assets/javascripts/.gitkeep
View
No changes.
0  episode-258/revised/bookstore-before/vendor/assets/stylesheets/.gitkeep
View
No changes.
0  episode-258/revised/bookstore-before/vendor/plugins/.gitkeep
View
No changes.
15 episode-258/revised/bookstore-chosen-after/.gitignore
View
@@ -0,0 +1,15 @@
+# See http://help.github.com/ignore-files/ for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile ~/.gitignore_global
+
+# Ignore bundler config
+/.bundle
+
+# Ignore the default SQLite database.
+/db/*.sqlite3
+
+# Ignore all logfiles and tempfiles.
+/log/*.log
+/tmp
44 episode-258/revised/bookstore-chosen-after/Gemfile
View
@@ -0,0 +1,44 @@
+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'
+
+ gem 'chosen-rails'
+end
+
+gem 'jquery-rails'
+
+gem 'faker', group: :development
+
+# 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'
+
+
118 episode-258/revised/bookstore-chosen-after/Gemfile.lock
View
@@ -0,0 +1,118 @@
+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)
+ chosen-rails (0.9.8)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ 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.1)
+ multi_json (~> 1.0)
+ faker (1.0.1)
+ i18n (~> 0.4)
+ 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.7.0)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.18)
+ multi_json (1.3.4)
+ 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.16)
+ sass-rails (3.2.5)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ sprockets (2.1.3)
+ 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
+ chosen-rails
+ coffee-rails (~> 3.2.1)
+ faker
+ jquery-rails
+ rails (= 3.2.3)
+ sass-rails (~> 3.2.3)
+ sqlite3
+ uglifier (>= 1.0.3)
9 episode-258/revised/bookstore-chosen-after/README.rdoc
View
@@ -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.
7 episode-258/revised/bookstore-chosen-after/Rakefile
View
@@ -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__)
+
+Bookstore::Application.load_tasks
BIN  episode-258/revised/bookstore-chosen-after/app/assets/images/rails.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 episode-258/revised/bookstore-chosen-after/app/assets/javascripts/application.js
View
@@ -0,0 +1,16 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+// GO AFTER THE REQUIRES BELOW.
+//
+//= require jquery
+//= require jquery_ujs
+//= require chosen-jquery
+//= require_tree .
3  episode-258/revised/bookstore-chosen-after/app/assets/javascripts/authors.js.coffee
View
@@ -0,0 +1,3 @@
+# 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/
5 episode-258/revised/bookstore-chosen-after/app/assets/javascripts/books.js.coffee
View
@@ -0,0 +1,5 @@
+# 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 ->
+ $('#book_author_ids').chosen()
14 episode-258/revised/bookstore-chosen-after/app/assets/stylesheets/application.css
View
@@ -0,0 +1,14 @@
+/*
+ * 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 chosen
+ *= require_tree .
+*/
3  episode-258/revised/bookstore-chosen-after/app/assets/stylesheets/authors.css.scss
View
@@ -0,0 +1,3 @@
+// Place all the styles related to the authors controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
6 episode-258/revised/bookstore-chosen-after/app/assets/stylesheets/books.css.scss
View
@@ -0,0 +1,6 @@
+// Place all the styles related to the books controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+#book_author_ids {
+ width: 450px;
+}
79 episode-258/revised/bookstore-chosen-after/app/assets/stylesheets/layout.css.scss
View
@@ -0,0 +1,79 @@
+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;
+}
3  episode-258/revised/bookstore-chosen-after/app/controllers/application_controller.rb
View
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
41 episode-258/revised/bookstore-chosen-after/app/controllers/authors_controller.rb
View
@@ -0,0 +1,41 @@
+class AuthorsController < ApplicationController
+ def index
+ @authors = Author.order(:name)
+ end
+
+ def show
+ @author = Author.find(params[:id])
+ end
+
+ def new
+ @author = Author.new
+ end
+
+ def create
+ @author = Author.new(params[:author])
+ if @author.save
+ redirect_to @author, notice: "Successfully created author."
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @author = Author.find(params[:id])
+ end
+
+ def update
+ @author = Author.find(params[:id])
+ if @author.update_attributes(params[:author])
+ redirect_to @author, notice: "Successfully updated author."
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @author = Author.find(params[:id])
+ @author.destroy
+ redirect_to authors_url, notice: "Successfully destroyed author."
+ end
+end
41 episode-258/revised/bookstore-chosen-after/app/controllers/books_controller.rb
View
@@ -0,0 +1,41 @@
+class BooksController < ApplicationController
+ def index
+ @books = Book.all
+ end
+
+ def show
+ @book = Book.find(params[:id])
+ end
+
+ def new
+ @book = Book.new
+ end
+
+ def create
+ @book = Book.new(params[:book])
+ if @book.save
+ redirect_to @book, notice: "Successfully created book."
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @book = Book.find(params[:id])
+ end
+
+ def update
+ @book = Book.find(params[:id])
+ if @book.update_attributes(params[:book])
+ redirect_to @book, notice: "Successfully updated book."
+ else
+ render :edit
+ end
+ end
+
+ def destroy