Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding episodes 302 and 303

  • Loading branch information...
commit 92d1a6708addea545f93aa2a0d3924348ee68949 1 parent 2e73455
Ryan Bates authored
Showing with 1,868 additions and 0 deletions.
  1. +5 −0 episode-302/README
  2. +15 −0 episode-302/profile-after/.gitignore
  3. +18 −0 episode-302/profile-after/Gemfile
  4. +118 −0 episode-302/profile-after/Gemfile.lock
  5. +9 −0 episode-302/profile-after/README
  6. +7 −0 episode-302/profile-after/Rakefile
  7. BIN  episode-302/profile-after/app/assets/images/rails.png
  8. +11 −0 episode-302/profile-after/app/assets/javascripts/application.js
  9. +5 −0 episode-302/profile-after/app/assets/javascripts/users.js.coffee
  10. +85 −0 episode-302/profile-after/app/assets/stylesheets/application.css
  11. +13 −0 episode-302/profile-after/app/assets/stylesheets/users.css.scss
  12. +3 −0  episode-302/profile-after/app/controllers/application_controller.rb
  13. +40 −0 episode-302/profile-after/app/controllers/users_controller.rb
  14. +2 −0  episode-302/profile-after/app/helpers/application_helper.rb
  15. +2 −0  episode-302/profile-after/app/helpers/users_helper.rb
  16. 0  episode-302/profile-after/app/mailers/.gitkeep
  17. 0  episode-302/profile-after/app/models/.gitkeep
  18. +4 −0 episode-302/profile-after/app/models/user.rb
  19. +17 −0 episode-302/profile-after/app/views/layouts/application.html.erb
  20. +37 −0 episode-302/profile-after/app/views/users/_form.html.erb
  21. +3 −0  episode-302/profile-after/app/views/users/edit.html.erb
  22. +7 −0 episode-302/profile-after/app/views/users/index.html.erb
  23. +5 −0 episode-302/profile-after/app/views/users/new.html.erb
  24. +23 −0 episode-302/profile-after/app/views/users/show.html.erb
  25. +4 −0 episode-302/profile-after/config.ru
  26. +48 −0 episode-302/profile-after/config/application.rb
  27. +6 −0 episode-302/profile-after/config/boot.rb
  28. +25 −0 episode-302/profile-after/config/database.yml
  29. +5 −0 episode-302/profile-after/config/environment.rb
  30. +30 −0 episode-302/profile-after/config/environments/development.rb
  31. +60 −0 episode-302/profile-after/config/environments/production.rb
  32. +39 −0 episode-302/profile-after/config/environments/test.rb
  33. +7 −0 episode-302/profile-after/config/initializers/backtrace_silencers.rb
  34. +10 −0 episode-302/profile-after/config/initializers/inflections.rb
  35. +5 −0 episode-302/profile-after/config/initializers/mime_types.rb
  36. +7 −0 episode-302/profile-after/config/initializers/secret_token.rb
  37. +8 −0 episode-302/profile-after/config/initializers/session_store.rb
  38. +14 −0 episode-302/profile-after/config/initializers/wrap_parameters.rb
  39. +5 −0 episode-302/profile-after/config/locales/en.yml
  40. +4 −0 episode-302/profile-after/config/routes.rb
  41. +13 −0 episode-302/profile-after/db/migrate/20111128231335_create_users.rb
  42. +26 −0 episode-302/profile-after/db/schema.rb
  43. +3 −0  episode-302/profile-after/db/seeds.rb
  44. +2 −0  episode-302/profile-after/doc/README_FOR_APP
  45. 0  episode-302/profile-after/lib/assets/.gitkeep
  46. 0  episode-302/profile-after/lib/tasks/.gitkeep
  47. 0  episode-302/profile-after/log/.gitkeep
  48. +26 −0 episode-302/profile-after/public/404.html
  49. +26 −0 episode-302/profile-after/public/422.html
  50. +26 −0 episode-302/profile-after/public/500.html
  51. 0  episode-302/profile-after/public/favicon.ico
  52. +5 −0 episode-302/profile-after/public/robots.txt
  53. +6 −0 episode-302/profile-after/script/rails
  54. 0  episode-302/profile-after/test/fixtures/.gitkeep
  55. +13 −0 episode-302/profile-after/test/fixtures/users.yml
  56. 0  episode-302/profile-after/test/functional/.gitkeep
  57. +49 −0 episode-302/profile-after/test/functional/users_controller_test.rb
  58. 0  episode-302/profile-after/test/integration/.gitkeep
  59. +12 −0 episode-302/profile-after/test/performance/browsing_test.rb
  60. +13 −0 episode-302/profile-after/test/test_helper.rb
  61. 0  episode-302/profile-after/test/unit/.gitkeep
  62. +4 −0 episode-302/profile-after/test/unit/helpers/users_helper_test.rb
  63. +7 −0 episode-302/profile-after/test/unit/user_test.rb
  64. 0  episode-302/profile-after/vendor/assets/stylesheets/.gitkeep
  65. 0  episode-302/profile-after/vendor/plugins/.gitkeep
  66. +15 −0 episode-302/profile-before/.gitignore
  67. +17 −0 episode-302/profile-before/Gemfile
  68. +118 −0 episode-302/profile-before/Gemfile.lock
  69. +9 −0 episode-302/profile-before/README
  70. +7 −0 episode-302/profile-before/Rakefile
  71. BIN  episode-302/profile-before/app/assets/images/rails.png
  72. +9 −0 episode-302/profile-before/app/assets/javascripts/application.js
  73. +3 −0  episode-302/profile-before/app/assets/javascripts/users.js.coffee
  74. +85 −0 episode-302/profile-before/app/assets/stylesheets/application.css
  75. +3 −0  episode-302/profile-before/app/assets/stylesheets/users.css.scss
  76. +3 −0  episode-302/profile-before/app/controllers/application_controller.rb
  77. +41 −0 episode-302/profile-before/app/controllers/users_controller.rb
  78. +2 −0  episode-302/profile-before/app/helpers/application_helper.rb
  79. +2 −0  episode-302/profile-before/app/helpers/users_helper.rb
  80. 0  episode-302/profile-before/app/mailers/.gitkeep
  81. 0  episode-302/profile-before/app/models/.gitkeep
  82. +4 −0 episode-302/profile-before/app/models/user.rb
  83. +17 −0 episode-302/profile-before/app/views/layouts/application.html.erb
  84. +37 −0 episode-302/profile-before/app/views/users/_form.html.erb
  85. +3 −0  episode-302/profile-before/app/views/users/edit.html.erb
  86. +7 −0 episode-302/profile-before/app/views/users/index.html.erb
  87. +5 −0 episode-302/profile-before/app/views/users/new.html.erb
  88. +23 −0 episode-302/profile-before/app/views/users/show.html.erb
  89. +4 −0 episode-302/profile-before/config.ru
  90. +48 −0 episode-302/profile-before/config/application.rb
  91. +6 −0 episode-302/profile-before/config/boot.rb
  92. +25 −0 episode-302/profile-before/config/database.yml
  93. +5 −0 episode-302/profile-before/config/environment.rb
  94. +30 −0 episode-302/profile-before/config/environments/development.rb
  95. +60 −0 episode-302/profile-before/config/environments/production.rb
  96. +39 −0 episode-302/profile-before/config/environments/test.rb
  97. +7 −0 episode-302/profile-before/config/initializers/backtrace_silencers.rb
  98. +10 −0 episode-302/profile-before/config/initializers/inflections.rb
  99. +5 −0 episode-302/profile-before/config/initializers/mime_types.rb
  100. +7 −0 episode-302/profile-before/config/initializers/secret_token.rb
  101. +8 −0 episode-302/profile-before/config/initializers/session_store.rb
  102. +14 −0 episode-302/profile-before/config/initializers/wrap_parameters.rb
  103. +5 −0 episode-302/profile-before/config/locales/en.yml
  104. +4 −0 episode-302/profile-before/config/routes.rb
  105. +13 −0 episode-302/profile-before/db/migrate/20111128231335_create_users.rb
  106. +26 −0 episode-302/profile-before/db/schema.rb
  107. +3 −0  episode-302/profile-before/db/seeds.rb
  108. +2 −0  episode-302/profile-before/doc/README_FOR_APP
  109. 0  episode-302/profile-before/lib/assets/.gitkeep
  110. 0  episode-302/profile-before/lib/tasks/.gitkeep
  111. 0  episode-302/profile-before/log/.gitkeep
  112. +26 −0 episode-302/profile-before/public/404.html
  113. +26 −0 episode-302/profile-before/public/422.html
  114. +26 −0 episode-302/profile-before/public/500.html
  115. 0  episode-302/profile-before/public/favicon.ico
  116. +5 −0 episode-302/profile-before/public/robots.txt
  117. +6 −0 episode-302/profile-before/script/rails
  118. 0  episode-302/profile-before/test/fixtures/.gitkeep
  119. +13 −0 episode-302/profile-before/test/fixtures/users.yml
  120. 0  episode-302/profile-before/test/functional/.gitkeep
  121. +49 −0 episode-302/profile-before/test/functional/users_controller_test.rb
  122. 0  episode-302/profile-before/test/integration/.gitkeep
  123. +12 −0 episode-302/profile-before/test/performance/browsing_test.rb
  124. +13 −0 episode-302/profile-before/test/test_helper.rb
  125. 0  episode-302/profile-before/test/unit/.gitkeep
  126. +4 −0 episode-302/profile-before/test/unit/helpers/users_helper_test.rb
  127. +7 −0 episode-302/profile-before/test/unit/user_test.rb
  128. 0  episode-302/profile-before/vendor/assets/stylesheets/.gitkeep
  129. 0  episode-302/profile-before/vendor/plugins/.gitkeep
  130. +12 −0 episode-303/README
  131. +1 −0  episode-303/url_formatter
5 episode-302/README
View
@@ -0,0 +1,5 @@
+RailsCasts Episode #302: In-Place Editing
+
+http://railscasts.com/episodes/302-in-place-editing
+
+Require Ruby 1.9.2 or later to run example.
15 episode-302/profile-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
18 episode-302/profile-after/Gemfile
View
@@ -0,0 +1,18 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.1.3'
+
+gem 'sqlite3'
+
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.1.5'
+ gem 'coffee-rails', '~> 3.1.1'
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
+gem 'best_in_place'
118 episode-302/profile-after/Gemfile.lock
View
@@ -0,0 +1,118 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.3)
+ actionpack (= 3.1.3)
+ mail (~> 2.3.0)
+ actionpack (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.5)
+ rack-cache (~> 1.1)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.3)
+ activemodel (3.1.3)
+ activesupport (= 3.1.3)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ arel (~> 2.2.1)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ activesupport (3.1.3)
+ multi_json (~> 1.0)
+ arel (2.2.1)
+ best_in_place (1.0.2)
+ jquery-rails
+ rails (~> 3.1.0)
+ 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.3)
+ erubis (2.7.0)
+ execjs (1.2.9)
+ multi_json (~> 1.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ jquery-rails (1.0.19)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ json (1.6.2)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.17.2)
+ multi_json (1.0.4)
+ polyglot (0.3.3)
+ rack (1.3.5)
+ 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.3)
+ actionmailer (= 3.1.3)
+ actionpack (= 3.1.3)
+ activerecord (= 3.1.3)
+ activeresource (= 3.1.3)
+ activesupport (= 3.1.3)
+ bundler (~> 1.0)
+ railties (= 3.1.3)
+ railties (3.1.3)
+ actionpack (= 3.1.3)
+ activesupport (= 3.1.3)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.11)
+ json (~> 1.4)
+ sass (3.1.11)
+ sass-rails (3.1.5)
+ actionpack (~> 3.1.0)
+ railties (~> 3.1.0)
+ sass (~> 3.1.10)
+ tilt (~> 1.3.2)
+ sprockets (2.0.3)
+ 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)
+ tzinfo (0.3.31)
+ uglifier (1.1.0)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ best_in_place
+ coffee-rails (~> 3.1.1)
+ jquery-rails
+ rails (= 3.1.3)
+ sass-rails (~> 3.1.5)
+ sqlite3
+ uglifier (>= 1.0.3)
9 episode-302/profile-after/README
View
@@ -0,0 +1,9 @@
+= RailsCasts Example Application
+
+Run these commands to try it out.
+
+ bundle
+ rake db:setup
+ rails s
+
+Require Ruby 1.9.2 or higher.
7 episode-302/profile-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__)
+
+Profile::Application.load_tasks
BIN  episode-302/profile-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.
11 episode-302/profile-after/app/assets/javascripts/application.js
View
@@ -0,0 +1,11 @@
+// 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 jquery.purr
+//= require best_in_place
+//= require_tree .
5 episode-302/profile-after/app/assets/javascripts/users.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 ->
+ $('.best_in_place').best_in_place()
85 episode-302/profile-after/app/assets/stylesheets/application.css
View
@@ -0,0 +1,85 @@
+/*
+ * 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 .
+*/
+
+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;
+ position: relative;
+}
+
+#flash_notice, #flash_error, #flash_alert {
+ padding: 5px 8px;
+ margin: 10px 0;
+ margin-right: 150px;
+}
+
+#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;
+}
+
+form .field, form .actions {
+ margin: 12px 0;
+}
13 episode-302/profile-after/app/assets/stylesheets/users.css.scss
View
@@ -0,0 +1,13 @@
+// Place all the styles related to the users controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+.purr {
+ position: fixed;
+ top: 30px;
+ right: 100px;
+ width: 250px;
+ padding: 20px;
+ background-color: #FCC;
+ border: solid 2px #C66;
+ &:first-letter { text-transform: uppercase; }
+}
3  episode-302/profile-after/app/controllers/application_controller.rb
View
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
40 episode-302/profile-after/app/controllers/users_controller.rb
View
@@ -0,0 +1,40 @@
+class UsersController < ApplicationController
+ respond_to :html, :json
+
+ def index
+ @users = User.all
+ end
+
+ def show
+ @user = User.find(params[:id])
+ end
+
+ def new
+ @user = User.new
+ end
+
+ def create
+ @user = User.new(params[:user])
+ if @user.save
+ redirect_to @user, notice: "Successfully created user."
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @user = User.find(params[:id])
+ end
+
+ def update
+ @user = User.find(params[:id])
+ @user.update_attributes(params[:user])
+ respond_with @user
+ end
+
+ def destroy
+ @user = User.find(params[:id])
+ @user.destroy
+ redirect_to users_url, notice: "Successfully destroyed user."
+ end
+end
2  episode-302/profile-after/app/helpers/application_helper.rb
View
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
2  episode-302/profile-after/app/helpers/users_helper.rb
View
@@ -0,0 +1,2 @@
+module UsersHelper
+end
0  episode-302/profile-after/app/mailers/.gitkeep
View
No changes.
0  episode-302/profile-after/app/models/.gitkeep
View
No changes.
4 episode-302/profile-after/app/models/user.rb
View
@@ -0,0 +1,4 @@
+class User < ActiveRecord::Base
+ validates_presence_of :name
+ validates_format_of :email, with: /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i
+end
17 episode-302/profile-after/app/views/layouts/application.html.erb
View
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Profile</title>
+ <%= stylesheet_link_tag "application" %>
+ <%= 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>
37 episode-302/profile-after/app/views/users/_form.html.erb
View
@@ -0,0 +1,37 @@
+<%= form_for(@user) do |f| %>
+ <% if @user.errors.any? %>
+ <div class="error_messages">
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
+
+ <ul>
+ <% @user.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="field">
+ <%= f.label :email %><br />
+ <%= f.text_field :email %>
+ </div>
+ <div class="field">
+ <%= f.label :gender %><br />
+ <%= f.select :gender, %w[Male Female Unspecified] %>
+ </div>
+ <div class="field">
+ <%= f.check_box :public_profile %>
+ <%= f.label :public_profile %>
+ </div>
+ <div class="field">
+ <%= f.label :bio %><br />
+ <%= f.text_area :bio %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
3  episode-302/profile-after/app/views/users/edit.html.erb
View
@@ -0,0 +1,3 @@
+<h1>Editing Profile</h1>
+
+<%= render 'form' %>
7 episode-302/profile-after/app/views/users/index.html.erb
View
@@ -0,0 +1,7 @@
+<h1>Users</h1>
+
+<ul>
+<% @users.each do |user| %>
+ <li><%= link_to user.name, user %></li>
+<% end %>
+</ul>
5 episode-302/profile-after/app/views/users/new.html.erb
View
@@ -0,0 +1,5 @@
+<h1>New user</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', users_path %>
23 episode-302/profile-after/app/views/users/show.html.erb
View
@@ -0,0 +1,23 @@
+<h1>User Profile</h1>
+
+<p>
+ <b>Name:</b>
+ <%= best_in_place @user, :name %>
+</p>
+<p>
+ <b>Email:</b>
+ <%= best_in_place @user, :email %>
+</p>
+<p>
+ <b>Gender:</b>
+ <%= best_in_place @user, :gender, type: :select, collection: [["Male", "Male"], ["Female", "Female"], ["", "Unspecified"]] %>
+</p>
+<p>
+ <b>Public profile:</b>
+ <%= best_in_place @user, :public_profile, type: :checkbox, collection: %w[No Yes] %>
+</p>
+<p>
+ <%= best_in_place @user, :bio, type: :textarea %>
+</p>
+
+<%= link_to 'Edit Profile', edit_user_path(@user) %>
4 episode-302/profile-after/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 Profile::Application
48 episode-302/profile-after/config/application.rb
View
@@ -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 Profile
+ 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
6 episode-302/profile-after/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-302/profile-after/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-302/profile-after/config/environment.rb
View
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Profile::Application.initialize!
30 episode-302/profile-after/config/environments/development.rb
View
@@ -0,0 +1,30 @@
+Profile::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
60 episode-302/profile-after/config/environments/production.rb
View
@@ -0,0 +1,60 @@
+Profile::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
39 episode-302/profile-after/config/environments/test.rb
View
@@ -0,0 +1,39 @@
+Profile::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
7 episode-302/profile-after/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!
10 episode-302/profile-after/config/initializers/inflections.rb
View
@@ -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
5 episode-302/profile-after/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-302/profile-after/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.
+Profile::Application.config.secret_token = '67a1af5d3de2b39a29327164e55de21ba0faff390e37b155d9c2cd48001ca86245bfc34b9f58937574506428a8a9b2b9645988a670e648357d338828e6d09654'
8 episode-302/profile-after/config/initializers/session_store.rb
View
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+Profile::Application.config.session_store :cookie_store, key: '_profile_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")
+# Profile::Application.config.session_store :active_record_store
14 episode-302/profile-after/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-302/profile-after/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"
4 episode-302/profile-after/config/routes.rb
View
@@ -0,0 +1,4 @@
+Profile::Application.routes.draw do
+ root to: 'users#index'
+ resources :users
+end
13 episode-302/profile-after/db/migrate/20111128231335_create_users.rb
View
@@ -0,0 +1,13 @@
+class CreateUsers < ActiveRecord::Migration
+ def change
+ create_table :users do |t|
+ t.string :name
+ t.string :email
+ t.string :gender
+ t.text :bio
+ t.boolean :public_profile
+
+ t.timestamps
+ end
+ end
+end
26 episode-302/profile-after/db/schema.rb
View
@@ -0,0 +1,26 @@
+# 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 => 20111128231335) do
+
+ create_table "users", :force => true do |t|
+ t.string "name"
+ t.string "email"
+ t.string "gender"
+ t.text "bio"
+ t.boolean "public_profile"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+end
3  episode-302/profile-after/db/seeds.rb
View
@@ -0,0 +1,3 @@
+User.create! name: "Batman", email: "batman@example.com", gender: "Male", public_profile: true, bio: <<-BIO
+The Dark Knight is dedicated to ridding Gotham of evil. Complete with his cape, utility belt, and bullet proof suite, no criminal has a chance against this Caped Crusader.
+BIO
2  episode-302/profile-after/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-302/profile-after/lib/assets/.gitkeep
View
No changes.
0  episode-302/profile-after/lib/tasks/.gitkeep
View
No changes.
0  episode-302/profile-after/log/.gitkeep
View
No changes.
26 episode-302/profile-after/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-302/profile-after/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>
26 episode-302/profile-after/public/500.html
View
@@ -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>
0  episode-302/profile-after/public/favicon.ico
View
No changes.
5 episode-302/profile-after/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-302/profile-after/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-302/profile-after/test/fixtures/.gitkeep
View
No changes.
13 episode-302/profile-after/test/fixtures/users.yml
View
@@ -0,0 +1,13 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ name: MyString
+ gender: MyString
+ bio: MyText
+ public_profile: false
+
+two:
+ name: MyString
+ gender: MyString
+ bio: MyText
+ public_profile: false
0  episode-302/profile-after/test/functional/.gitkeep
View
No changes.
49 episode-302/profile-after/test/functional/users_controller_test.rb
View
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class UsersControllerTest < ActionController::TestCase
+ setup do
+ @user = users(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:users)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create user" do
+ assert_difference('User.count') do
+ post :create, user: @user.attributes
+ end
+
+ assert_redirected_to user_path(assigns(:user))
+ end
+
+ test "should show user" do
+ get :show, id: @user.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @user.to_param
+ assert_response :success
+ end
+
+ test "should update user" do
+ put :update, id: @user.to_param, user: @user.attributes
+ assert_redirected_to user_path(assigns(:user))
+ end
+
+ test "should destroy user" do
+ assert_difference('User.count', -1) do
+ delete :destroy, id: @user.to_param
+ end
+
+ assert_redirected_to users_path
+ end
+end
0  episode-302/profile-after/test/integration/.gitkeep
View
No changes.
12 episode-302/profile-after/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-302/profile-after/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-302/profile-after/test/unit/.gitkeep
View
No changes.
4 episode-302/profile-after/test/unit/helpers/users_helper_test.rb
View
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class UsersHelperTest < ActionView::TestCase
+end
7 episode-302/profile-after/test/unit/user_test.rb
View
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class UserTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
0  episode-302/profile-after/vendor/assets/stylesheets/.gitkeep
View
No changes.
0  episode-302/profile-after/vendor/plugins/.gitkeep
View
No changes.
15 episode-302/profile-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
17 episode-302/profile-before/Gemfile
View
@@ -0,0 +1,17 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.1.3'
+
+gem 'sqlite3'
+
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.1.5'
+ gem 'coffee-rails', '~> 3.1.1'
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
118 episode-302/profile-before/Gemfile.lock
View
@@ -0,0 +1,118 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.3)
+ actionpack (= 3.1.3)
+ mail (~> 2.3.0)
+ actionpack (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.5)
+ rack-cache (~> 1.1)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.3)
+ activemodel (3.1.3)
+ activesupport (= 3.1.3)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ arel (~> 2.2.1)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ activesupport (3.1.3)
+ multi_json (~> 1.0)
+ ansi (1.4.1)
+ 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.3)
+ erubis (2.7.0)
+ execjs (1.2.9)
+ multi_json (~> 1.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ jquery-rails (1.0.19)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ json (1.6.2)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.17.2)
+ multi_json (1.0.4)
+ polyglot (0.3.3)
+ rack (1.3.5)
+ 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.3)
+ actionmailer (= 3.1.3)
+ actionpack (= 3.1.3)
+ activerecord (= 3.1.3)
+ activeresource (= 3.1.3)
+ activesupport (= 3.1.3)
+ bundler (~> 1.0)
+ railties (= 3.1.3)
+ railties (3.1.3)
+ actionpack (= 3.1.3)
+ activesupport (= 3.1.3)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.11)
+ json (~> 1.4)
+ sass (3.1.11)
+ sass-rails (3.1.5)
+ actionpack (~> 3.1.0)
+ railties (~> 3.1.0)
+ sass (~> 3.1.10)
+ tilt (~> 1.3.2)
+ sprockets (2.0.3)
+ 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.3)
+ ansi
+ tzinfo (0.3.31)
+ uglifier (1.1.0)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-rails (~> 3.1.1)
+ jquery-rails
+ rails (= 3.1.3)
+ sass-rails (~> 3.1.5)
+ sqlite3
+ turn (~> 0.8.3)
+ uglifier (>= 1.0.3)
9 episode-302/profile-before/README
View
@@ -0,0 +1,9 @@
+= RailsCasts Example Application
+
+Run these commands to try it out.
+
+ bundle
+ rake db:setup
+ rails s
+
+Require Ruby 1.9.2 or higher.
7 episode-302/profile-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__)
+
+Profile::Application.load_tasks
BIN  episode-302/profile-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.
9 episode-302/profile-before/app/assets/javascripts/application.js
View
@@ -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 .
3  episode-302/profile-before/app/assets/javascripts/users.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/
85 episode-302/profile-before/app/assets/stylesheets/application.css
View
@@ -0,0 +1,85 @@
+/*
+ * 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 .
+*/
+
+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;
+ position: relative;
+}
+
+#flash_notice, #flash_error, #flash_alert {
+ padding: 5px 8px;
+ margin: 10px 0;
+ margin-right: 150px;
+}
+
+#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;
+}
+
+form .field, form .actions {
+ margin: 12px 0;
+}
3  episode-302/profile-before/app/assets/stylesheets/users.css.scss
View
@@ -0,0 +1,3 @@
+// Place all the styles related to the users controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
3  episode-302/profile-before/app/controllers/application_controller.rb
View
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
41 episode-302/profile-before/app/controllers/users_controller.rb
View
@@ -0,0 +1,41 @@
+class UsersController < ApplicationController
+ def index
+ @users = User.all
+ end
+
+ def show
+ @user = User.find(params[:id])
+ end
+
+ def new
+ @user = User.new
+ end
+
+ def create
+ @user = User.new(params[:user])
+ if @user.save
+ redirect_to @user, notice: "Successfully created user."
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @user = User.find(params[:id])
+ end
+
+ def update
+ @user = User.find(params[:id])
+ if @user.update_attributes(params[:user])
+ redirect_to @user, notice: "Successfully updated user."
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @user = User.find(params[:id])
+ @user.destroy
+ redirect_to users_url, notice: "Successfully destroyed user."
+ end
+end
2  episode-302/profile-before/app/helpers/application_helper.rb
View
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
2  episode-302/profile-before/app/helpers/users_helper.rb
View
@@ -0,0 +1,2 @@
+module UsersHelper
+end
0  episode-302/profile-before/app/mailers/.gitkeep
View
No changes.
0  episode-302/profile-before/app/models/.gitkeep
View
No changes.
4 episode-302/profile-before/app/models/user.rb
View
@@ -0,0 +1,4 @@
+class User < ActiveRecord::Base
+ validates_presence_of :name
+ validates_format_of :email, with: /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i
+end
17 episode-302/profile-before/app/views/layouts/application.html.erb
View
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Profile</title>
+ <%= stylesheet_link_tag "application" %>
+ <%= 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>
37 episode-302/profile-before/app/views/users/_form.html.erb
View
@@ -0,0 +1,37 @@
+<%= form_for(@user) do |f| %>
+ <% if @user.errors.any? %>
+ <div class="error_messages">
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
+
+ <ul>
+ <% @user.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="field">
+ <%= f.label :email %><br />
+ <%= f.text_field :email %>
+ </div>
+ <div class="field">
+ <%= f.label :gender %><br />
+ <%= f.select :gender, %w[Male Female Unspecified] %>
+ </div>
+ <div class="field">
+ <%= f.check_box :public_profile %>
+ <%= f.label :public_profile %>
+ </div>
+ <div class="field">
+ <%= f.label :bio %><br />
+ <%= f.text_area :bio %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
3  episode-302/profile-before/app/views/users/edit.html.erb
View
@@ -0,0 +1,3 @@
+<h1>Editing Profile</h1>
+
+<%= render 'form' %>
7 episode-302/profile-before/app/views/users/index.html.erb
View
@@ -0,0 +1,7 @@
+<h1>Users</h1>
+
+<ul>
+<% @users.each do |user| %>
+ <li><%= link_to user.name, user %></li>
+<% end %>
+</ul>
5 episode-302/profile-before/app/views/users/new.html.erb
View
@@ -0,0 +1,5 @@
+<h1>New user</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', users_path %>
23 episode-302/profile-before/app/views/users/show.html.erb
View
@@ -0,0 +1,23 @@
+<h1>User Profile</h1>
+
+<p>
+ <b>Name:</b>
+ <%= @user.name %>
+</p>
+<p>
+ <b>Email:</b>
+ <%= @user.email %>
+</p>
+<p>
+ <b>Gender:</b>
+ <%= @user.gender %>
+</p>
+<p>
+ <b>Public profile:</b>
+ <%= @user.public_profile %>
+</p>
+<p>
+ <%= @user.bio %>
+</p>
+
+<%= link_to 'Edit Profile', edit_user_path(@user) %>
4 episode-302/profile-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 Profile::Application
48 episode-302/profile-before/config/application.rb
View
@@ -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 Profile
+ 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
6 episode-302/profile-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-302/profile-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-302/profile-before/config/environment.rb
View
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Profile::Application.initialize!
30 episode-302/profile-before/config/environments/development.rb
View
@@ -0,0 +1,30 @@
+Profile::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
60 episode-302/profile-before/config/environments/production.rb
View
@@ -0,0 +1,60 @@
+Profile::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
39 episode-302/profile-before/config/environments/test.rb
View
@@ -0,0 +1,39 @@
+Profile::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
7 episode-302/profile-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!
10 episode-302/profile-before/config/initializers/inflections.rb
View
@@ -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
5 episode-302/profile-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-302/profile-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.
+Profile::Application.config.secret_token = '67a1af5d3de2b39a29327164e55de21ba0faff390e37b155d9c2cd48001ca86245bfc34b9f58937574506428a8a9b2b9645988a670e648357d338828e6d09654'
8 episode-302/profile-before/config/initializers/session_store.rb
View
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+Profile::Application.config.session_store :cookie_store, key: '_profile_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")
+# Profile::Application.config.session_store :active_record_store
14 episode-302/profile-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-302/profile-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"
4 episode-302/profile-before/config/routes.rb
View
@@ -0,0 +1,4 @@
+Profile::Application.routes.draw do
+ root to: 'users#index'
+ resources :users
+end
13 episode-302/profile-before/db/migrate/20111128231335_create_users.rb
View
@@ -0,0 +1,13 @@
+class CreateUsers < ActiveRecord::Migration
+ def change
+ create_table :users do |t|
+ t.string :name
+ t.string :email
+ t.string :gender
+ t.text :bio
+ t.boolean :public_profile
+
+ t.timestamps
+ end
+ end
+end
26 episode-302/profile-before/db/schema.rb
View
@@ -0,0 +1,26 @@
+# 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 => 20111128231335) do
+
+ create_table "users", :force => true do |t|
+ t.string "name"
+ t.string "email"
+ t.string "gender"
+ t.text "bio"
+ t.boolean "public_profile"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+end
3  episode-302/profile-before/db/seeds.rb
View
@@ -0,0 +1,3 @@
+User.create! name: "Batman", email: "batman@example.com", gender: "Male", public_profile: true, bio: <<-BIO
+The Dark Knight is dedicated to ridding Gotham of evil. Complete with his cape, utility belt, and bullet proof suite, no criminal has a chance against this Caped Crusader.
+BIO
2  episode-302/profile-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-302/profile-before/lib/assets/.gitkeep
View
No changes.
0  episode-302/profile-before/lib/tasks/.gitkeep
View
No changes.
0  episode-302/profile-before/log/.gitkeep
View
No changes.
26 episode-302/profile-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-302/profile-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>
26 episode-302/profile-before/public/500.html
View
@@ -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>
0  episode-302/profile-before/public/favicon.ico
View
No changes.
5 episode-302/profile-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-302/profile-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-302/profile-before/test/fixtures/.gitkeep
View
No changes.
13 episode-302/profile-before/test/fixtures/users.yml
View
@@ -0,0 +1,13 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ name: MyString
+ gender: MyString
+ bio: MyText
+ public_profile: false
+
+two:
+ name: MyString
+ gender: MyString
+ bio: MyText
+ public_profile: false
0  episode-302/profile-before/test/functional/.gitkeep
View
No changes.
49 episode-302/profile-before/test/functional/users_controller_test.rb
View
<
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class UsersControllerTest < ActionController::TestCase
+ setup do
+ @user = users(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:users)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create user" do