Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding episodes 288 and 289

  • Loading branch information...
commit a958167b94479d65b247007221eb2577ff006028 1 parent 4d9586c
@ryanb authored
Showing with 4,291 additions and 0 deletions.
  1. +7 −0 episode-288/README
  2. +5 −0 episode-288/saas-after/.gitignore
  3. +17 −0 episode-288/saas-after/Gemfile
  4. +119 −0 episode-288/saas-after/Gemfile.lock
  5. +7 −0 episode-288/saas-after/README
  6. +7 −0 episode-288/saas-after/Rakefile
  7. BIN  episode-288/saas-after/app/assets/images/llama.jpg
  8. BIN  episode-288/saas-after/app/assets/images/rails.png
  9. +9 −0 episode-288/saas-after/app/assets/javascripts/application.js
  10. +3 −0  episode-288/saas-after/app/assets/javascripts/plans.js.coffee
  11. +32 −0 episode-288/saas-after/app/assets/javascripts/subscriptions.js.coffee
  12. +96 −0 episode-288/saas-after/app/assets/stylesheets/application.css
  13. +82 −0 episode-288/saas-after/app/assets/stylesheets/plans.css.scss
  14. +10 −0 episode-288/saas-after/app/assets/stylesheets/subscriptions.css.scss
  15. +3 −0  episode-288/saas-after/app/controllers/application_controller.rb
  16. +5 −0 episode-288/saas-after/app/controllers/plans_controller.rb
  17. +19 −0 episode-288/saas-after/app/controllers/subscriptions_controller.rb
  18. +2 −0  episode-288/saas-after/app/helpers/application_helper.rb
  19. +2 −0  episode-288/saas-after/app/helpers/plans_helper.rb
  20. +2 −0  episode-288/saas-after/app/helpers/subscriptions_helper.rb
  21. 0  episode-288/saas-after/app/mailers/.gitkeep
  22. 0  episode-288/saas-after/app/models/.gitkeep
  23. +3 −0  episode-288/saas-after/app/models/plan.rb
  24. +19 −0 episode-288/saas-after/app/models/subscription.rb
  25. +18 −0 episode-288/saas-after/app/views/layouts/application.html.erb
  26. +20 −0 episode-288/saas-after/app/views/plans/index.html.erb
  27. +47 −0 episode-288/saas-after/app/views/subscriptions/new.html.erb
  28. +4 −0 episode-288/saas-after/app/views/subscriptions/show.html.erb
  29. +4 −0 episode-288/saas-after/config.ru
  30. +48 −0 episode-288/saas-after/config/application.rb
  31. +6 −0 episode-288/saas-after/config/boot.rb
  32. +25 −0 episode-288/saas-after/config/database.yml
  33. +5 −0 episode-288/saas-after/config/environment.rb
  34. +30 −0 episode-288/saas-after/config/environments/development.rb
  35. +60 −0 episode-288/saas-after/config/environments/production.rb
  36. +39 −0 episode-288/saas-after/config/environments/test.rb
  37. +7 −0 episode-288/saas-after/config/initializers/backtrace_silencers.rb
  38. +10 −0 episode-288/saas-after/config/initializers/inflections.rb
  39. +5 −0 episode-288/saas-after/config/initializers/mime_types.rb
  40. +7 −0 episode-288/saas-after/config/initializers/secret_token.rb
  41. +8 −0 episode-288/saas-after/config/initializers/session_store.rb
  42. +2 −0  episode-288/saas-after/config/initializers/stripe.rb
  43. +14 −0 episode-288/saas-after/config/initializers/wrap_parameters.rb
  44. +5 −0 episode-288/saas-after/config/locales/en.yml
  45. +5 −0 episode-288/saas-after/config/routes.rb
  46. +11 −0 episode-288/saas-after/db/migrate/20111008163507_create_plans.rb
  47. +10 −0 episode-288/saas-after/db/migrate/20111008164003_create_subscriptions.rb
  48. +5 −0 episode-288/saas-after/db/migrate/20111009193136_add_stripe_to_subscriptions.rb
  49. +32 −0 episode-288/saas-after/db/schema.rb
  50. +4 −0 episode-288/saas-after/db/seeds.rb
  51. +2 −0  episode-288/saas-after/doc/README_FOR_APP
  52. 0  episode-288/saas-after/lib/assets/.gitkeep
  53. 0  episode-288/saas-after/lib/tasks/.gitkeep
  54. 0  episode-288/saas-after/log/.gitkeep
  55. +26 −0 episode-288/saas-after/public/404.html
  56. +26 −0 episode-288/saas-after/public/422.html
  57. +26 −0 episode-288/saas-after/public/500.html
  58. 0  episode-288/saas-after/public/favicon.ico
  59. +5 −0 episode-288/saas-after/public/robots.txt
  60. +6 −0 episode-288/saas-after/script/rails
  61. 0  episode-288/saas-after/test/fixtures/.gitkeep
  62. +11 −0 episode-288/saas-after/test/fixtures/plans.yml
  63. +9 −0 episode-288/saas-after/test/fixtures/subscriptions.yml
  64. 0  episode-288/saas-after/test/functional/.gitkeep
  65. +9 −0 episode-288/saas-after/test/functional/plans_controller_test.rb
  66. +49 −0 episode-288/saas-after/test/functional/subscriptions_controller_test.rb
  67. 0  episode-288/saas-after/test/integration/.gitkeep
  68. +12 −0 episode-288/saas-after/test/performance/browsing_test.rb
  69. +13 −0 episode-288/saas-after/test/test_helper.rb
  70. 0  episode-288/saas-after/test/unit/.gitkeep
  71. +4 −0 episode-288/saas-after/test/unit/helpers/plans_helper_test.rb
  72. +4 −0 episode-288/saas-after/test/unit/helpers/subscriptions_helper_test.rb
  73. +7 −0 episode-288/saas-after/test/unit/plan_test.rb
  74. +7 −0 episode-288/saas-after/test/unit/subscription_test.rb
  75. 0  episode-288/saas-after/vendor/assets/stylesheets/.gitkeep
  76. 0  episode-288/saas-after/vendor/plugins/.gitkeep
  77. +5 −0 episode-288/saas-before/.gitignore
  78. +15 −0 episode-288/saas-before/Gemfile
  79. +117 −0 episode-288/saas-before/Gemfile.lock
  80. +7 −0 episode-288/saas-before/README
  81. +7 −0 episode-288/saas-before/Rakefile
  82. BIN  episode-288/saas-before/app/assets/images/llama.jpg
  83. BIN  episode-288/saas-before/app/assets/images/rails.png
  84. +9 −0 episode-288/saas-before/app/assets/javascripts/application.js
  85. +3 −0  episode-288/saas-before/app/assets/javascripts/plans.js.coffee
  86. +3 −0  episode-288/saas-before/app/assets/javascripts/subscriptions.js.coffee
  87. +96 −0 episode-288/saas-before/app/assets/stylesheets/application.css
  88. +82 −0 episode-288/saas-before/app/assets/stylesheets/plans.css.scss
  89. +10 −0 episode-288/saas-before/app/assets/stylesheets/subscriptions.css.scss
  90. +3 −0  episode-288/saas-before/app/controllers/application_controller.rb
  91. +5 −0 episode-288/saas-before/app/controllers/plans_controller.rb
  92. +19 −0 episode-288/saas-before/app/controllers/subscriptions_controller.rb
  93. +2 −0  episode-288/saas-before/app/helpers/application_helper.rb
  94. +2 −0  episode-288/saas-before/app/helpers/plans_helper.rb
  95. +2 −0  episode-288/saas-before/app/helpers/subscriptions_helper.rb
  96. 0  episode-288/saas-before/app/mailers/.gitkeep
  97. 0  episode-288/saas-before/app/models/.gitkeep
  98. +3 −0  episode-288/saas-before/app/models/plan.rb
  99. +5 −0 episode-288/saas-before/app/models/subscription.rb
  100. +17 −0 episode-288/saas-before/app/views/layouts/application.html.erb
  101. +20 −0 episode-288/saas-before/app/views/plans/index.html.erb
  102. +25 −0 episode-288/saas-before/app/views/subscriptions/new.html.erb
  103. +4 −0 episode-288/saas-before/app/views/subscriptions/show.html.erb
  104. +4 −0 episode-288/saas-before/config.ru
  105. +48 −0 episode-288/saas-before/config/application.rb
  106. +6 −0 episode-288/saas-before/config/boot.rb
  107. +25 −0 episode-288/saas-before/config/database.yml
  108. +5 −0 episode-288/saas-before/config/environment.rb
  109. +30 −0 episode-288/saas-before/config/environments/development.rb
  110. +60 −0 episode-288/saas-before/config/environments/production.rb
  111. +39 −0 episode-288/saas-before/config/environments/test.rb
  112. +7 −0 episode-288/saas-before/config/initializers/backtrace_silencers.rb
  113. +10 −0 episode-288/saas-before/config/initializers/inflections.rb
  114. +5 −0 episode-288/saas-before/config/initializers/mime_types.rb
  115. +7 −0 episode-288/saas-before/config/initializers/secret_token.rb
  116. +8 −0 episode-288/saas-before/config/initializers/session_store.rb
  117. +14 −0 episode-288/saas-before/config/initializers/wrap_parameters.rb
  118. +5 −0 episode-288/saas-before/config/locales/en.yml
  119. +5 −0 episode-288/saas-before/config/routes.rb
  120. +11 −0 episode-288/saas-before/db/migrate/20111008163507_create_plans.rb
  121. +10 −0 episode-288/saas-before/db/migrate/20111008164003_create_subscriptions.rb
  122. +31 −0 episode-288/saas-before/db/schema.rb
  123. +4 −0 episode-288/saas-before/db/seeds.rb
  124. +2 −0  episode-288/saas-before/doc/README_FOR_APP
  125. 0  episode-288/saas-before/lib/assets/.gitkeep
  126. 0  episode-288/saas-before/lib/tasks/.gitkeep
  127. 0  episode-288/saas-before/log/.gitkeep
  128. +26 −0 episode-288/saas-before/public/404.html
  129. +26 −0 episode-288/saas-before/public/422.html
  130. +26 −0 episode-288/saas-before/public/500.html
  131. 0  episode-288/saas-before/public/favicon.ico
  132. +5 −0 episode-288/saas-before/public/robots.txt
  133. +6 −0 episode-288/saas-before/script/rails
  134. 0  episode-288/saas-before/test/fixtures/.gitkeep
  135. +11 −0 episode-288/saas-before/test/fixtures/plans.yml
  136. +9 −0 episode-288/saas-before/test/fixtures/subscriptions.yml
  137. 0  episode-288/saas-before/test/functional/.gitkeep
  138. +9 −0 episode-288/saas-before/test/functional/plans_controller_test.rb
  139. +49 −0 episode-288/saas-before/test/functional/subscriptions_controller_test.rb
  140. 0  episode-288/saas-before/test/integration/.gitkeep
  141. +12 −0 episode-288/saas-before/test/performance/browsing_test.rb
  142. +13 −0 episode-288/saas-before/test/test_helper.rb
  143. 0  episode-288/saas-before/test/unit/.gitkeep
  144. +4 −0 episode-288/saas-before/test/unit/helpers/plans_helper_test.rb
  145. +4 −0 episode-288/saas-before/test/unit/helpers/subscriptions_helper_test.rb
  146. +7 −0 episode-288/saas-before/test/unit/plan_test.rb
  147. +7 −0 episode-288/saas-before/test/unit/subscription_test.rb
  148. 0  episode-288/saas-before/vendor/assets/stylesheets/.gitkeep
  149. 0  episode-288/saas-before/vendor/plugins/.gitkeep
  150. +8 −0 episode-289/README
  151. +5 −0 episode-289/saas-after/.gitignore
  152. +18 −0 episode-289/saas-after/Gemfile
  153. +121 −0 episode-289/saas-after/Gemfile.lock
  154. +7 −0 episode-289/saas-after/README
  155. +7 −0 episode-289/saas-after/Rakefile
  156. BIN  episode-289/saas-after/app/assets/images/american_express.png
  157. BIN  episode-289/saas-after/app/assets/images/cvv.png
  158. BIN  episode-289/saas-after/app/assets/images/discover.png
  159. BIN  episode-289/saas-after/app/assets/images/jcb.png
  160. BIN  episode-289/saas-after/app/assets/images/llama.jpg
  161. BIN  episode-289/saas-after/app/assets/images/mastercard.png
  162. BIN  episode-289/saas-after/app/assets/images/paypal.png
  163. BIN  episode-289/saas-after/app/assets/images/rails.png
  164. BIN  episode-289/saas-after/app/assets/images/visa.png
  165. +9 −0 episode-289/saas-after/app/assets/javascripts/application.js
  166. +3 −0  episode-289/saas-after/app/assets/javascripts/plans.js.coffee
  167. +40 −0 episode-289/saas-after/app/assets/javascripts/subscriptions.js.coffee
  168. +96 −0 episode-289/saas-after/app/assets/stylesheets/application.css
  169. +82 −0 episode-289/saas-after/app/assets/stylesheets/plans.css.scss
  170. +16 −0 episode-289/saas-after/app/assets/stylesheets/subscriptions.css.scss
  171. +3 −0  episode-289/saas-after/app/controllers/application_controller.rb
  172. +5 −0 episode-289/saas-after/app/controllers/plans_controller.rb
  173. +33 −0 episode-289/saas-after/app/controllers/subscriptions_controller.rb
  174. +2 −0  episode-289/saas-after/app/helpers/application_helper.rb
  175. +2 −0  episode-289/saas-after/app/helpers/plans_helper.rb
  176. +2 −0  episode-289/saas-after/app/helpers/subscriptions_helper.rb
  177. 0  episode-289/saas-after/app/mailers/.gitkeep
  178. 0  episode-289/saas-after/app/models/.gitkeep
  179. +33 −0 episode-289/saas-after/app/models/paypal_payment.rb
  180. +3 −0  episode-289/saas-after/app/models/plan.rb
  181. +41 −0 episode-289/saas-after/app/models/subscription.rb
  182. +18 −0 episode-289/saas-after/app/views/layouts/application.html.erb
  183. +20 −0 episode-289/saas-after/app/views/plans/index.html.erb
  184. +71 −0 episode-289/saas-after/app/views/subscriptions/new.html.erb
  185. +4 −0 episode-289/saas-after/app/views/subscriptions/show.html.erb
  186. +4 −0 episode-289/saas-after/config.ru
  187. +48 −0 episode-289/saas-after/config/application.rb
  188. +6 −0 episode-289/saas-after/config/boot.rb
  189. +25 −0 episode-289/saas-after/config/database.yml
  190. +5 −0 episode-289/saas-after/config/environment.rb
  191. +30 −0 episode-289/saas-after/config/environments/development.rb
  192. +60 −0 episode-289/saas-after/config/environments/production.rb
  193. +39 −0 episode-289/saas-after/config/environments/test.rb
  194. +7 −0 episode-289/saas-after/config/initializers/backtrace_silencers.rb
  195. +10 −0 episode-289/saas-after/config/initializers/inflections.rb
  196. +5 −0 episode-289/saas-after/config/initializers/mime_types.rb
  197. +6 −0 episode-289/saas-after/config/initializers/paypal.rb
  198. +7 −0 episode-289/saas-after/config/initializers/secret_token.rb
  199. +8 −0 episode-289/saas-after/config/initializers/session_store.rb
  200. +2 −0  episode-289/saas-after/config/initializers/stripe.rb
  201. +14 −0 episode-289/saas-after/config/initializers/wrap_parameters.rb
  202. +5 −0 episode-289/saas-after/config/locales/en.yml
  203. +6 −0 episode-289/saas-after/config/routes.rb
  204. +11 −0 episode-289/saas-after/db/migrate/20111008163507_create_plans.rb
  205. +10 −0 episode-289/saas-after/db/migrate/20111008164003_create_subscriptions.rb
  206. +5 −0 episode-289/saas-after/db/migrate/20111009193136_add_stripe_to_subscriptions.rb
  207. +6 −0 episode-289/saas-after/db/migrate/20111010033056_add_paypal_to_subscriptions.rb
  208. +34 −0 episode-289/saas-after/db/schema.rb
  209. +4 −0 episode-289/saas-after/db/seeds.rb
  210. +2 −0  episode-289/saas-after/doc/README_FOR_APP
  211. 0  episode-289/saas-after/lib/assets/.gitkeep
  212. 0  episode-289/saas-after/lib/tasks/.gitkeep
  213. 0  episode-289/saas-after/log/.gitkeep
  214. +26 −0 episode-289/saas-after/public/404.html
  215. +26 −0 episode-289/saas-after/public/422.html
  216. +26 −0 episode-289/saas-after/public/500.html
  217. 0  episode-289/saas-after/public/favicon.ico
  218. +5 −0 episode-289/saas-after/public/robots.txt
  219. +6 −0 episode-289/saas-after/script/rails
  220. 0  episode-289/saas-after/test/fixtures/.gitkeep
  221. +11 −0 episode-289/saas-after/test/fixtures/plans.yml
  222. +9 −0 episode-289/saas-after/test/fixtures/subscriptions.yml
  223. 0  episode-289/saas-after/test/functional/.gitkeep
  224. +9 −0 episode-289/saas-after/test/functional/plans_controller_test.rb
  225. +49 −0 episode-289/saas-after/test/functional/subscriptions_controller_test.rb
  226. 0  episode-289/saas-after/test/integration/.gitkeep
  227. +12 −0 episode-289/saas-after/test/performance/browsing_test.rb
  228. +13 −0 episode-289/saas-after/test/test_helper.rb
  229. 0  episode-289/saas-after/test/unit/.gitkeep
  230. +4 −0 episode-289/saas-after/test/unit/helpers/plans_helper_test.rb
  231. +4 −0 episode-289/saas-after/test/unit/helpers/subscriptions_helper_test.rb
  232. +7 −0 episode-289/saas-after/test/unit/plan_test.rb
  233. +7 −0 episode-289/saas-after/test/unit/subscription_test.rb
  234. 0  episode-289/saas-after/vendor/assets/stylesheets/.gitkeep
  235. 0  episode-289/saas-after/vendor/plugins/.gitkeep
  236. +5 −0 episode-289/saas-before/.gitignore
  237. +16 −0 episode-289/saas-before/Gemfile
  238. +119 −0 episode-289/saas-before/Gemfile.lock
  239. +7 −0 episode-289/saas-before/README
  240. +7 −0 episode-289/saas-before/Rakefile
  241. BIN  episode-289/saas-before/app/assets/images/american_express.png
  242. BIN  episode-289/saas-before/app/assets/images/cvv.png
  243. BIN  episode-289/saas-before/app/assets/images/discover.png
  244. BIN  episode-289/saas-before/app/assets/images/jcb.png
  245. BIN  episode-289/saas-before/app/assets/images/llama.jpg
  246. BIN  episode-289/saas-before/app/assets/images/mastercard.png
  247. BIN  episode-289/saas-before/app/assets/images/paypal.png
  248. BIN  episode-289/saas-before/app/assets/images/rails.png
  249. BIN  episode-289/saas-before/app/assets/images/visa.png
  250. +9 −0 episode-289/saas-before/app/assets/javascripts/application.js
  251. +3 −0  episode-289/saas-before/app/assets/javascripts/plans.js.coffee
  252. +32 −0 episode-289/saas-before/app/assets/javascripts/subscriptions.js.coffee
  253. +96 −0 episode-289/saas-before/app/assets/stylesheets/application.css
  254. +82 −0 episode-289/saas-before/app/assets/stylesheets/plans.css.scss
  255. +16 −0 episode-289/saas-before/app/assets/stylesheets/subscriptions.css.scss
  256. +3 −0  episode-289/saas-before/app/controllers/application_controller.rb
  257. +5 −0 episode-289/saas-before/app/controllers/plans_controller.rb
  258. +19 −0 episode-289/saas-before/app/controllers/subscriptions_controller.rb
  259. +2 −0  episode-289/saas-before/app/helpers/application_helper.rb
  260. +2 −0  episode-289/saas-before/app/helpers/plans_helper.rb
  261. +2 −0  episode-289/saas-before/app/helpers/subscriptions_helper.rb
  262. 0  episode-289/saas-before/app/mailers/.gitkeep
  263. 0  episode-289/saas-before/app/models/.gitkeep
  264. +3 −0  episode-289/saas-before/app/models/plan.rb
  265. +19 −0 episode-289/saas-before/app/models/subscription.rb
  266. +18 −0 episode-289/saas-before/app/views/layouts/application.html.erb
  267. +20 −0 episode-289/saas-before/app/views/plans/index.html.erb
  268. +46 −0 episode-289/saas-before/app/views/subscriptions/new.html.erb
  269. +4 −0 episode-289/saas-before/app/views/subscriptions/show.html.erb
  270. +4 −0 episode-289/saas-before/config.ru
  271. +48 −0 episode-289/saas-before/config/application.rb
  272. +6 −0 episode-289/saas-before/config/boot.rb
  273. +25 −0 episode-289/saas-before/config/database.yml
  274. +5 −0 episode-289/saas-before/config/environment.rb
  275. +30 −0 episode-289/saas-before/config/environments/development.rb
  276. +60 −0 episode-289/saas-before/config/environments/production.rb
  277. +39 −0 episode-289/saas-before/config/environments/test.rb
  278. +7 −0 episode-289/saas-before/config/initializers/backtrace_silencers.rb
  279. +10 −0 episode-289/saas-before/config/initializers/inflections.rb
  280. +5 −0 episode-289/saas-before/config/initializers/mime_types.rb
  281. +7 −0 episode-289/saas-before/config/initializers/secret_token.rb
  282. +8 −0 episode-289/saas-before/config/initializers/session_store.rb
  283. +2 −0  episode-289/saas-before/config/initializers/stripe.rb
  284. +14 −0 episode-289/saas-before/config/initializers/wrap_parameters.rb
  285. +5 −0 episode-289/saas-before/config/locales/en.yml
  286. +5 −0 episode-289/saas-before/config/routes.rb
  287. +11 −0 episode-289/saas-before/db/migrate/20111008163507_create_plans.rb
  288. +10 −0 episode-289/saas-before/db/migrate/20111008164003_create_subscriptions.rb
  289. +5 −0 episode-289/saas-before/db/migrate/20111009193136_add_stripe_to_subscriptions.rb
  290. +32 −0 episode-289/saas-before/db/schema.rb
  291. +4 −0 episode-289/saas-before/db/seeds.rb
  292. +2 −0  episode-289/saas-before/doc/README_FOR_APP
  293. 0  episode-289/saas-before/lib/assets/.gitkeep
  294. 0  episode-289/saas-before/lib/tasks/.gitkeep
  295. 0  episode-289/saas-before/log/.gitkeep
  296. +26 −0 episode-289/saas-before/public/404.html
  297. +26 −0 episode-289/saas-before/public/422.html
  298. +26 −0 episode-289/saas-before/public/500.html
  299. 0  episode-289/saas-before/public/favicon.ico
  300. +5 −0 episode-289/saas-before/public/robots.txt
Sorry, we could not display the entire diff because too many files (317) changed.
View
7 episode-288/README
@@ -0,0 +1,7 @@
+RailsCasts Episode #288: Billing with Stripe
+
+http://railscasts.com/episodes/288-billing-with-stripe
+
+Commands used in episode
+
+ rails g migration add_stripe_to_subscriptions stripe_customer_token:string
View
5 episode-288/saas-after/.gitignore
@@ -0,0 +1,5 @@
+.bundle
+db/*.sqlite3
+log/*.log
+tmp/
+.sass-cache/
View
17 episode-288/saas-after/Gemfile
@@ -0,0 +1,17 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.1.1'
+gem 'rack', '1.3.3'
+gem 'sqlite3'
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.1.4'
+ gem 'coffee-rails', '~> 3.1.1'
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
+gem 'stripe'
View
119 episode-288/saas-after/Gemfile.lock
@@ -0,0 +1,119 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.1)
+ actionpack (= 3.1.1)
+ mail (~> 2.3.0)
+ actionpack (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.2)
+ rack-cache (~> 1.1)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.2)
+ activemodel (3.1.1)
+ activesupport (= 3.1.1)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ arel (~> 2.2.1)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ activesupport (3.1.1)
+ multi_json (~> 1.0)
+ arel (2.2.1)
+ builder (3.0.0)
+ coffee-rails (3.1.1)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.1.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.1.2)
+ erubis (2.7.0)
+ execjs (1.2.9)
+ multi_json (~> 1.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ jquery-rails (1.0.14)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ multi_json (1.0.3)
+ polyglot (0.3.2)
+ rack (1.3.3)
+ rack-cache (1.1)
+ rack (>= 0.4)
+ rack-mount (0.8.3)
+ rack (>= 1.0.0)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.1.1)
+ actionmailer (= 3.1.1)
+ actionpack (= 3.1.1)
+ activerecord (= 3.1.1)
+ activeresource (= 3.1.1)
+ activesupport (= 3.1.1)
+ bundler (~> 1.0)
+ railties (= 3.1.1)
+ railties (3.1.1)
+ actionpack (= 3.1.1)
+ activesupport (= 3.1.1)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2)
+ rdoc (3.9.4)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
+ sass (3.1.10)
+ sass-rails (3.1.4)
+ actionpack (~> 3.1.0)
+ railties (~> 3.1.0)
+ sass (>= 3.1.4)
+ sprockets (~> 2.0.0)
+ tilt (~> 1.3.2)
+ sprockets (2.0.2)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.4)
+ stripe (1.5.20)
+ rest-client
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.30)
+ uglifier (1.0.3)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-rails (~> 3.1.1)
+ jquery-rails
+ rack (= 1.3.3)
+ rails (= 3.1.1)
+ sass-rails (~> 3.1.4)
+ sqlite3
+ stripe
+ uglifier (>= 1.0.3)
View
7 episode-288/saas-after/README
@@ -0,0 +1,7 @@
+= RailsCasts Example Application
+
+Run these commands to try it out.
+
+ bundle
+ rake db:setup
+ rails s
View
7 episode-288/saas-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__)
+
+Saas::Application.load_tasks
View
BIN  episode-288/saas-after/app/assets/images/llama.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  episode-288/saas-after/app/assets/images/rails.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
9 episode-288/saas-after/app/assets/javascripts/application.js
@@ -0,0 +1,9 @@
+// This is a manifest file that'll be compiled into including all the files listed below.
+// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
+// be included in the compiled file accessible from http://example.com/assets/application.js
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
View
3  episode-288/saas-after/app/assets/javascripts/plans.js.coffee
@@ -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/
View
32 episode-288/saas-after/app/assets/javascripts/subscriptions.js.coffee
@@ -0,0 +1,32 @@
+# 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 ->
+ Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content'))
+ subscription.setupForm()
+
+subscription =
+ setupForm: ->
+ $('#new_subscription').submit ->
+ $('input[type=submit]').attr('disabled', true)
+ if $('#card_number').length
+ subscription.processCard()
+ false
+ else
+ true
+
+ processCard: ->
+ card =
+ number: $('#card_number').val()
+ cvc: $('#card_code').val()
+ expMonth: $('#card_month').val()
+ expYear: $('#card_year').val()
+ Stripe.createToken(card, subscription.handleStripeResponse)
+
+ handleStripeResponse: (status, response) ->
+ if status == 200
+ $('#subscription_stripe_card_token').val(response.id)
+ $('#new_subscription')[0].submit()
+ else
+ $('#stripe_error').text(response.error.message)
+ $('input[type=submit]').attr('disabled', false)
View
96 episode-288/saas-after/app/assets/stylesheets/application.css
@@ -0,0 +1,96 @@
+/*
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
+ * and any sub-directories. 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;
+ text-decoration: none;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+.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;
+}
+
+form label {
+ display: block;
+ margin-bottom: 2px;
+}
+
+form .field, form .actions {
+ margin: 12px 0;
+}
+
+.fieldWithErrors {
+ display: inline;
+}
+
+.error_messages {
+ width: 400px;
+ border: 2px solid #CF0000;
+ padding: 0px;
+ 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: 15px 0;
+}
View
82 episode-288/saas-after/app/assets/stylesheets/plans.css.scss
@@ -0,0 +1,82 @@
+// Place all the styles related to the home controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+#plans {
+ background-image: image-url("llama.jpg");
+ background-repeat: no-repeat;
+ background-position: 480px -10px;
+ margin: 0 auto;
+ padding-top: 60px;
+ margin-bottom: 10px;
+ width: 642px;
+ h1 {
+ font-size: 65px;
+ font-family: Georgia, Times;
+ margin-top: 0;
+ margin-bottom: 12px;
+ }
+ .plan {
+ float: left;
+ width: 150px;
+ text-align: center;
+ margin-right: 10px;
+ .name {
+ color: #FFF;
+ padding: 5px 0;
+ border: solid 1px #5B6881;
+ border-bottom: none;
+ background: #386FB2;
+ background: -webkit-gradient(linear, left top, left bottom, from(#67B0EF), to(#2B5EA4));
+ background: -moz-linear-gradient(top, #579CEA, #2B5EA4);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#579CEA', endColorstr='#2B5EA4');
+ border-top-left-radius: 5px;
+ border-top-right-radius: 5px;
+ -webkit-border-top-left-radius: 5px;
+ -webkit-border-top-right-radius: 5px;
+ -moz-border-radius-topleft: 5px;
+ -moz-border-radius-topright: 5px;
+ }
+ .details {
+ padding-top: 5px;
+ border: solid 1px #8D8D8D;
+ background-color: #E8F4FD;
+ border-top: none;
+ border-bottom-left-radius: 5px;
+ border-bottom-right-radius: 5px;
+ -webkit-border-bottom-left-radius: 5px;
+ -webkit-border-bottom-right-radius: 5px;
+ -moz-border-radius-bottomleft: 5px;
+ -moz-border-radius-bottomright: 5px;
+ }
+ .price {
+ font-size: 50px;
+ }
+ .per_month {
+ font-size: 12px;
+ margin-bottom: 10px;
+ color: #5E5E5E;
+ }
+ .kisses {
+ font-size: 18px;
+ }
+ .signup {
+ margin: 20px;
+ a {
+ font-size: 13px;
+ padding: 5px 10px 6px 10px;
+ font-weight: bold;
+ border: 1px solid #2A7531;
+ border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ color: #FFF;
+ background: #328039;
+ background: -webkit-gradient(linear, left top, left bottom, from(#56D854), to(#328039));
+ background: -moz-linear-gradient(top, #56D854, #328039);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#56D854', endColorstr='#328039');
+ text-decoration: none;
+ text-shadow: 0 -1px 0 #036;
+ }
+ }
+ }
+}
View
10 episode-288/saas-after/app/assets/stylesheets/subscriptions.css.scss
@@ -0,0 +1,10 @@
+#subscription {
+ width: 400px;
+ h1 {
+ font-size: 24px;
+ }
+}
+
+#stripe_error {
+ color: #D00;
+}
View
3  episode-288/saas-after/app/controllers/application_controller.rb
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
View
5 episode-288/saas-after/app/controllers/plans_controller.rb
@@ -0,0 +1,5 @@
+class PlansController < ApplicationController
+ def index
+ @plans = Plan.order("price")
+ end
+end
View
19 episode-288/saas-after/app/controllers/subscriptions_controller.rb
@@ -0,0 +1,19 @@
+class SubscriptionsController < ApplicationController
+ def new
+ plan = Plan.find(params[:plan_id])
+ @subscription = plan.subscriptions.build
+ end
+
+ def create
+ @subscription = Subscription.new(params[:subscription])
+ if @subscription.save_with_payment
+ redirect_to @subscription, :notice => "Thank you for subscribing!"
+ else
+ render :new
+ end
+ end
+
+ def show
+ @subscription = Subscription.find(params[:id])
+ end
+end
View
2  episode-288/saas-after/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
View
2  episode-288/saas-after/app/helpers/plans_helper.rb
@@ -0,0 +1,2 @@
+module PlansHelper
+end
View
2  episode-288/saas-after/app/helpers/subscriptions_helper.rb
@@ -0,0 +1,2 @@
+module SubscriptionsHelper
+end
View
0  episode-288/saas-after/app/mailers/.gitkeep
No changes.
View
0  episode-288/saas-after/app/models/.gitkeep
No changes.
View
3  episode-288/saas-after/app/models/plan.rb
@@ -0,0 +1,3 @@
+class Plan < ActiveRecord::Base
+ has_many :subscriptions
+end
View
19 episode-288/saas-after/app/models/subscription.rb
@@ -0,0 +1,19 @@
+class Subscription < ActiveRecord::Base
+ belongs_to :plan
+ validates_presence_of :plan_id
+ validates_presence_of :email
+
+ attr_accessor :stripe_card_token
+
+ def save_with_payment
+ if valid?
+ customer = Stripe::Customer.create(description: email, plan: plan_id, card: stripe_card_token)
+ self.stripe_customer_token = customer.id
+ save!
+ end
+ rescue Stripe::InvalidRequestError => e
+ logger.error "Stripe error while creating customer: #{e.message}"
+ errors.add :base, "There was a problem with your credit card."
+ false
+ end
+end
View
18 episode-288/saas-after/app/views/layouts/application.html.erb
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Llama Kisses</title>
+ <%= stylesheet_link_tag "application" %>
+ <%= javascript_include_tag "https://js.stripe.com/v1/", "application" %>
+ <%= csrf_meta_tags %>
+ <%= tag :meta, :name => "stripe-key", :content => STRIPE_PUBLIC_KEY %>
+</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-288/saas-after/app/views/plans/index.html.erb
@@ -0,0 +1,20 @@
+<div id="plans">
+ <h1>Llama Kisses</h1>
+ <% @plans.each do |plan| %>
+ <div class="plan">
+ <div class="name"><%= plan.name %></div>
+ <div class="details">
+ <div class="price">
+ <%= number_to_currency plan.price, :precision => 0 %>
+ </div>
+ <div class="per_month">per month</div>
+ <div class="kisses"><%= plan.kisses %> kisses</div>
+ <div class="per_month">per month</div>
+ <div class="signup">
+ <%= link_to "Sign up", new_subscription_path(:plan_id => plan.id) %>
+ </div>
+ </div>
+ </div>
+ <% end %>
+ <div class="clear"></div>
+</div>
View
47 episode-288/saas-after/app/views/subscriptions/new.html.erb
@@ -0,0 +1,47 @@
+<h1>Signing up for "<%= @subscription.plan.name %>"</h1>
+<p>Includes <strong><%= @subscription.plan.kisses %> llama kisses</strong> for only <strong><%= number_to_currency @subscription.plan.price %></strong> per month!</p>
+
+<%= form_for @subscription do |f| %>
+ <% if @subscription.errors.any? %>
+ <div class="error_messages">
+ <h2><%= pluralize(@subscription.errors.count, "error") %> prohibited this subscription from being saved:</h2>
+ <ul>
+ <% @subscription.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <%= f.hidden_field :plan_id %>
+
+ <%= f.hidden_field :stripe_card_token %>
+
+ <div class="field">
+ <%= f.label :email %>
+ <%= f.text_field :email %>
+ </div>
+ <% if @subscription.stripe_card_token.present? %>
+ Credit card has been provided.
+ <% else %>
+ <div class="field">
+ <%= label_tag :card_number, "Credit Card Number" %>
+ <%= text_field_tag :card_number, nil, name: nil %>
+ </div>
+ <div class="field">
+ <%= label_tag :card_code, "Security Code on Card (CVV)" %>
+ <%= text_field_tag :card_code, nil, name: nil %>
+ </div>
+ <div class="field">
+ <%= label_tag :card_month, "Card Expiration" %>
+ <%= select_month nil, {add_month_numbers: true}, {name: nil, id: "card_month"} %>
+ <%= select_year nil, {start_year: Date.today.year, end_year: Date.today.year+15}, {name: nil, id: "card_year"} %>
+ </div>
+ <% end %>
+ <div id="stripe_error">
+ <noscript>JavaScript is not enabled and is required for this form. First enable it in your web browser settings.</noscript>
+ </div>
+ <div class="actions">
+ <%= f.submit "Subscribe" %>
+ </div>
+<% end %>
View
4 episode-288/saas-after/app/views/subscriptions/show.html.erb
@@ -0,0 +1,4 @@
+<div id="subscription">
+ <h1>Your Subscription</h1>
+ <p>You have signed up for the <strong><%= @subscription.plan.name %></strong> plan which includes <strong><%= @subscription.plan.kisses %> llama kisses</strong> for just <strong><%= number_to_currency @subscription.plan.price %></strong> per month!</p>
+</div>
View
4 episode-288/saas-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 Saas::Application
View
48 episode-288/saas-after/config/application.rb
@@ -0,0 +1,48 @@
+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 Saas
+ 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]
+
+ # 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
6 episode-288/saas-after/config/boot.rb
@@ -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'])
View
25 episode-288/saas-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-288/saas-after/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Saas::Application.initialize!
View
30 episode-288/saas-after/config/environments/development.rb
@@ -0,0 +1,30 @@
+Saas::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
+
+ # Do not compress assets
+ config.assets.compress = false
+
+ # Expands the lines which load the assets
+ config.assets.debug = true
+end
View
60 episode-288/saas-after/config/environments/production.rb
@@ -0,0 +1,60 @@
+Saas::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
+
+ # Use a different logger for distributed setups
+ # config.logger = 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
+end
View
39 episode-288/saas-after/config/environments/test.rb
@@ -0,0 +1,39 @@
+Saas::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
+
+ # Use SQL instead of Active Record's schema dumper when creating the test 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
+
+ # Print deprecation notices to the stderr
+ config.active_support.deprecation = :stderr
+end
View
7 episode-288/saas-after/config/initializers/backtrace_silencers.rb
@@ -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!
View
10 episode-288/saas-after/config/initializers/inflections.rb
@@ -0,0 +1,10 @@
+# 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
View
5 episode-288/saas-after/config/initializers/mime_types.rb
@@ -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
View
7 episode-288/saas-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.
+Saas::Application.config.secret_token = '6e2b941713e5b9fa57cdff558772b88dc6dca42e74641bb01b835b0caa70526a0baf3c264a5bb6815cf1f5943ed48499ec66939e8984e0d84beed97b01923c0c'
View
8 episode-288/saas-after/config/initializers/session_store.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+Saas::Application.config.session_store :cookie_store, key: '_saas_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")
+# Saas::Application.config.session_store :active_record_store
View
2  episode-288/saas-after/config/initializers/stripe.rb
@@ -0,0 +1,2 @@
+Stripe.api_key = "tGaNWsIG3Qy6zvXB8wv4rEcizJpSXjF4"
+STRIPE_PUBLIC_KEY = "pk_KcSyS2qPWdT5SdrwkQg0vNSyhZgqP"
View
14 episode-288/saas-after/config/initializers/wrap_parameters.rb
@@ -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
View
5 episode-288/saas-after/config/locales/en.yml
@@ -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"
View
5 episode-288/saas-after/config/routes.rb
@@ -0,0 +1,5 @@
+Saas::Application.routes.draw do
+ root to: 'plans#index'
+ resources :subscriptions
+ resources :plans
+end
View
11 episode-288/saas-after/db/migrate/20111008163507_create_plans.rb
@@ -0,0 +1,11 @@
+class CreatePlans < ActiveRecord::Migration
+ def change
+ create_table :plans do |t|
+ t.string :name
+ t.decimal :price
+ t.integer :kisses
+
+ t.timestamps
+ end
+ end
+end
View
10 episode-288/saas-after/db/migrate/20111008164003_create_subscriptions.rb
@@ -0,0 +1,10 @@
+class CreateSubscriptions < ActiveRecord::Migration
+ def change
+ create_table :subscriptions do |t|
+ t.integer :plan_id
+ t.string :email
+
+ t.timestamps
+ end
+ end
+end
View
5 episode-288/saas-after/db/migrate/20111009193136_add_stripe_to_subscriptions.rb
@@ -0,0 +1,5 @@
+class AddStripeToSubscriptions < ActiveRecord::Migration
+ def change
+ add_column :subscriptions, :stripe_customer_token, :string
+ end
+end
View
32 episode-288/saas-after/db/schema.rb
@@ -0,0 +1,32 @@
+# 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 => 20111009193136) do
+
+ create_table "plans", :force => true do |t|
+ t.string "name"
+ t.decimal "price"
+ t.integer "kisses"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "subscriptions", :force => true do |t|
+ t.integer "plan_id"
+ t.string "email"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "stripe_customer_token"
+ end
+
+end
View
4 episode-288/saas-after/db/seeds.rb
@@ -0,0 +1,4 @@
+Plan.create!(:name => "Never Been Kissed", :price => 5, :kisses => 3)
+Plan.create!(:name => "Can't Get Enough", :price => 12, :kisses => 10)
+Plan.create!(:name => "Pure Bliss", :price => 49, :kisses => 100)
+Plan.create!(:name => "I'm in Heaven", :price => 99, :kisses => 250)
View
2  episode-288/saas-after/doc/README_FOR_APP
@@ -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.
View
0  episode-288/saas-after/lib/assets/.gitkeep
No changes.
View
0  episode-288/saas-after/lib/tasks/.gitkeep
No changes.
View
0  episode-288/saas-after/log/.gitkeep
No changes.
View
26 episode-288/saas-after/public/404.html
@@ -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>
View
26 episode-288/saas-after/public/422.html
@@ -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>
View
26 episode-288/saas-after/public/500.html
@@ -0,0 +1,26 @@
+<!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>
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
+ </div>
+</body>
+</html>
View
0  episode-288/saas-after/public/favicon.ico
No changes.
View
5 episode-288/saas-after/public/robots.txt
@@ -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: /
View
6 episode-288/saas-after/script/rails
@@ -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'
View
0  episode-288/saas-after/test/fixtures/.gitkeep
No changes.
View
11 episode-288/saas-after/test/fixtures/plans.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ name: MyString
+ price: 9.99
+ kisses: 1
+
+two:
+ name: MyString
+ price: 9.99
+ kisses: 1
View
9 episode-288/saas-after/test/fixtures/subscriptions.yml
@@ -0,0 +1,9 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ plan_id: 1
+ email: MyString
+
+two:
+ plan_id: 1
+ email: MyString
View
0  episode-288/saas-after/test/functional/.gitkeep
No changes.
View
9 episode-288/saas-after/test/functional/plans_controller_test.rb
@@ -0,0 +1,9 @@
+require 'test_helper'
+
+class PlansControllerTest < ActionController::TestCase
+ test "should get index" do
+ get :index
+ assert_response :success
+ end
+
+end
View
49 episode-288/saas-after/test/functional/subscriptions_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class SubscriptionsControllerTest < ActionController::TestCase
+ setup do
+ @subscription = subscriptions(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:subscriptions)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create subscription" do
+ assert_difference('Subscription.count') do
+ post :create, subscription: @subscription.attributes
+ end
+
+ assert_redirected_to subscription_path(assigns(:subscription))
+ end
+
+ test "should show subscription" do
+ get :show, id: @subscription.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @subscription.to_param
+ assert_response :success
+ end
+
+ test "should update subscription" do
+ put :update, id: @subscription.to_param, subscription: @subscription.attributes
+ assert_redirected_to subscription_path(assigns(:subscription))
+ end
+
+ test "should destroy subscription" do
+ assert_difference('Subscription.count', -1) do
+ delete :destroy, id: @subscription.to_param
+ end
+
+ assert_redirected_to subscriptions_path
+ end
+end
View
0  episode-288/saas-after/test/integration/.gitkeep
No changes.
View
12 episode-288/saas-after/test/performance/browsing_test.rb
@@ -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
View
13 episode-288/saas-after/test/test_helper.rb
@@ -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
View
0  episode-288/saas-after/test/unit/.gitkeep
No changes.
View
4 episode-288/saas-after/test/unit/helpers/plans_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class PlansHelperTest < ActionView::TestCase
+end
View
4 episode-288/saas-after/test/unit/helpers/subscriptions_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class SubscriptionsHelperTest < ActionView::TestCase
+end
View
7 episode-288/saas-after/test/unit/plan_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class PlanTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
View
7 episode-288/saas-after/test/unit/subscription_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class SubscriptionTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
View
0  episode-288/saas-after/vendor/assets/stylesheets/.gitkeep
No changes.
View
0  episode-288/saas-after/vendor/plugins/.gitkeep
No changes.
View
5 episode-288/saas-before/.gitignore
@@ -0,0 +1,5 @@
+.bundle
+db/*.sqlite3
+log/*.log
+tmp/
+.sass-cache/
View
15 episode-288/saas-before/Gemfile
@@ -0,0 +1,15 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.1.1'
+gem 'sqlite3'
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.1.4'
+ gem 'coffee-rails', '~> 3.1.1'
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
View
117 episode-288/saas-before/Gemfile.lock
@@ -0,0 +1,117 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.1)
+ actionpack (= 3.1.1)
+ mail (~> 2.3.0)
+ actionpack (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.2)
+ rack-cache (~> 1.1)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.2)
+ activemodel (3.1.1)
+ activesupport (= 3.1.1)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ arel (~> 2.2.1)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.1)
+ activemodel (= 3.1.1)
+ activesupport (= 3.1.1)
+ activesupport (3.1.1)
+ multi_json (~> 1.0)
+ ansi (1.3.0)
+ arel (2.2.1)
+ builder (3.0.0)
+ coffee-rails (3.1.1)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.1.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.1.2)
+ erubis (2.7.0)
+ execjs (1.2.9)
+ multi_json (~> 1.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ jquery-rails (1.0.14)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ multi_json (1.0.3)
+ polyglot (0.3.2)
+ rack (1.3.4)
+ rack-cache (1.1)
+ rack (>= 0.4)
+ rack-mount (0.8.3)
+ rack (>= 1.0.0)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.1.1)
+ actionmailer (= 3.1.1)
+ actionpack (= 3.1.1)
+ activerecord (= 3.1.1)
+ activeresource (= 3.1.1)
+ activesupport (= 3.1.1)
+ bundler (~> 1.0)
+ railties (= 3.1.1)
+ railties (3.1.1)
+ actionpack (= 3.1.1)
+ activesupport (= 3.1.1)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2)
+ rdoc (3.9.4)
+ sass (3.1.10)
+ sass-rails (3.1.4)
+ actionpack (~> 3.1.0)
+ railties (~> 3.1.0)
+ sass (>= 3.1.4)
+ sprockets (~> 2.0.0)
+ tilt (~> 1.3.2)
+ sprockets (2.0.2)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.4)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ turn (0.8.2)
+ ansi (>= 1.2.2)
+ tzinfo (0.3.30)
+ uglifier (1.0.3)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-rails (~> 3.1.1)
+ jquery-rails
+ rails (= 3.1.1)
+ sass-rails (~> 3.1.4)
+ sqlite3
+ turn
+ uglifier (>= 1.0.3)
View
7 episode-288/saas-before/README
@@ -0,0 +1,7 @@
+= RailsCasts Example Application
+
+Run these commands to try it out.
+
+ bundle
+ rake db:setup
+ rails s
View
7 episode-288/saas-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__)
+
+Saas::Application.load_tasks
View
BIN  episode-288/saas-before/app/assets/images/llama.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  episode-288/saas-before/app/assets/images/rails.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
9 episode-288/saas-before/app/assets/javascripts/application.js
@@ -0,0 +1,9 @@
+// This is a manifest file that'll be compiled into including all the files listed below.
+// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
+// be included in the compiled file accessible from http://example.com/assets/application.js
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
View
3  episode-288/saas-before/app/assets/javascripts/plans.js.coffee
@@ -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/
View
3  episode-288/saas-before/app/assets/javascripts/subscriptions.js.coffee
@@ -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/
View
96 episode-288/saas-before/app/assets/stylesheets/application.css
@@ -0,0 +1,96 @@
+/*
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
+ * and any sub-directories. 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;
+ text-decoration: none;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+.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;
+}
+
+form label {
+ display: block;
+ margin-bottom: 2px;
+}
+
+form .field, form .actions {
+ margin: 12px 0;
+}
+
+.fieldWithErrors {
+ display: inline;
+}
+
+.error_messages {
+ width: 400px;
+ border: 2px solid #CF0000;
+ padding: 0px;
+ 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: 15px 0;
+}
View
82 episode-288/saas-before/app/assets/stylesheets/plans.css.scss
@@ -0,0 +1,82 @@
+// Place all the styles related to the home controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+#plans {
+ background-image: image-url("llama.jpg");
+ background-repeat: no-repeat;
+ background-position: 480px -10px;
+ margin: 0 auto;
+ padding-top: 60px;
+ margin-bottom: 10px;
+ width: 642px;
+ h1 {
+ font-size: 65px;
+ font-family: Georgia, Times;
+ margin-top: 0;
+ margin-bottom: 12px;
+ }
+ .plan {
+ float: left;
+ width: 150px;
+ text-align: center;
+ margin-right: 10px;
+ .name {
+ color: #FFF;
+ padding: 5px 0;
+ border: solid 1px #5B6881;
+ border-bottom: none;
+ background: #386FB2;
+ background: -webkit-gradient(linear, left top, left bottom, from(#67B0EF), to(#2B5EA4));
+ background: -moz-linear-gradient(top, #579CEA, #2B5EA4);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#579CEA', endColorstr='#2B5EA4');
+ border-top-left-radius: 5px;
+ border-top-right-radius: 5px;
+ -webkit-border-top-left-radius: 5px;
+ -webkit-border-top-right-radius: 5px;
+ -moz-border-radius-topleft: 5px;
+ -moz-border-radius-topright: 5px;
+ }
+ .details {
+ padding-top: 5px;
+ border: solid 1px #8D8D8D;
+ background-color: #E8F4FD;
+ border-top: none;
+ border-bottom-left-radius: 5px;
+ border-bottom-right-radius: 5px;
+ -webkit-border-bottom-left-radius: 5px;
+ -webkit-border-bottom-right-radius: 5px;
+ -moz-border-radius-bottomleft: 5px;
+ -moz-border-radius-bottomright: 5px;
+ }
+ .price {
+ font-size: 50px;
+ }
+ .per_month {
+ font-size: 12px;
+ margin-bottom: 10px;
+ color: #5E5E5E;
+ }
+ .kisses {
+ font-size: 18px;
+ }
+ .signup {
+ margin: 20px;
+ a {
+ font-size: 13px;
+ padding: 5px 10px 6px 10px;
+ font-weight: bold;
+ border: 1px solid #2A7531;
+ border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ color: #FFF;
+ background: #328039;
+ background: -webkit-gradient(linear, left top, left bottom, from(#56D854), to(#328039));
+ background: -moz-linear-gradient(top, #56D854, #328039);
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#56D854', endColorstr='#328039');
+ text-decoration: none;
+ text-shadow: 0 -1px 0 #036;
+ }
+ }
+ }
+}
View
10 episode-288/saas-before/app/assets/stylesheets/subscriptions.css.scss
@@ -0,0 +1,10 @@
+#subscription {
+ width: 400px;
+ h1 {
+ font-size: 24px;
+ }
+}
+
+#stripe_error {
+ color: #D00;
+}
View
3  episode-288/saas-before/app/controllers/application_controller.rb
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
View
5 episode-288/saas-before/app/controllers/plans_controller.rb
@@ -0,0 +1,5 @@
+class PlansController < ApplicationController
+ def index
+ @plans = Plan.order("price")
+ end
+end
View
19