Permalink
Browse files

fixing up before/after code in episode 260

  • Loading branch information...
1 parent 922772d commit de20fd918bf492e647dd4373e301e3ed666873ac @ryanb committed Apr 5, 2011
Showing with 4 additions and 9,279 deletions.
  1. 0 episode-260/{chatter → chatter-after}/.gitignore
  2. 0 episode-260/{chatter → chatter-after}/Gemfile
  3. 0 episode-260/{chatter → chatter-after}/Gemfile.lock
  4. 0 episode-260/{chatter → chatter-after}/Rakefile
  5. 0 episode-260/{chatter → chatter-after}/app/controllers/application_controller.rb
  6. 0 episode-260/{chatter → chatter-after}/app/controllers/messages_controller.rb
  7. 0 episode-260/{chatter → chatter-after}/app/helpers/application_helper.rb
  8. 0 episode-260/{chatter → chatter-after}/app/helpers/error_messages_helper.rb
  9. 0 episode-260/{chatter → chatter-after}/app/helpers/layout_helper.rb
  10. 0 episode-260/{chatter → chatter-after}/app/helpers/messages_helper.rb
  11. 0 episode-260/{chatter → chatter-after}/app/models/message.rb
  12. 0 episode-260/{chatter → chatter-after}/app/views/layouts/application.html.erb
  13. 0 episode-260/{chatter → chatter-after}/app/views/messages/_message.html.erb
  14. 0 episode-260/{chatter → chatter-after}/app/views/messages/create.js.erb
  15. 0 episode-260/{chatter → chatter-after}/app/views/messages/index.html.erb
  16. 0 episode-260/{chatter → chatter-after}/config.ru
  17. 0 episode-260/{chatter → chatter-after}/config/application.rb
  18. 0 episode-260/{chatter → chatter-after}/config/boot.rb
  19. 0 episode-260/{chatter → chatter-after}/config/database.yml
  20. 0 episode-260/{chatter → chatter-after}/config/environment.rb
  21. 0 episode-260/{chatter → chatter-after}/config/environments/development.rb
  22. 0 episode-260/{chatter → chatter-after}/config/environments/production.rb
  23. 0 episode-260/{chatter → chatter-after}/config/environments/test.rb
  24. 0 episode-260/{chatter → chatter-after}/config/initializers/backtrace_silencers.rb
  25. 0 episode-260/{chatter → chatter-after}/config/initializers/faye_token.rb
  26. 0 episode-260/{chatter → chatter-after}/config/initializers/inflections.rb
  27. 0 episode-260/{chatter → chatter-after}/config/initializers/mime_types.rb
  28. 0 episode-260/{chatter → chatter-after}/config/initializers/secret_token.rb
  29. 0 episode-260/{chatter → chatter-after}/config/initializers/session_store.rb
  30. 0 episode-260/{chatter → chatter-after}/config/locales/en.yml
  31. 0 episode-260/{chatter → chatter-after}/config/routes.rb
  32. 0 episode-260/{chatter → chatter-after}/db/migrate/20110403022903_create_messages.rb
  33. 0 episode-260/{chatter → chatter-after}/db/schema.rb
  34. 0 episode-260/{chatter → chatter-after}/db/seeds.rb
  35. 0 episode-260/{chatter → chatter-after}/doc/README_FOR_APP
  36. 0 episode-260/{chatter → chatter-after}/faye.ru
  37. 0 episode-260/{chatter/vendor/plugins → chatter-after/lib/tasks}/.gitkeep
  38. 0 episode-260/{chatter → chatter-after}/public/404.html
  39. 0 episode-260/{chatter → chatter-after}/public/422.html
  40. 0 episode-260/{chatter → chatter-after}/public/500.html
  41. 0 episode-260/{chatter → chatter-after}/public/favicon.ico
  42. BIN episode-260/{chatter → chatter-after}/public/images/rails.png
  43. 0 episode-260/{chatter → chatter-after}/public/javascripts/application.js
  44. 0 episode-260/{chatter → chatter-after}/public/javascripts/jquery.js
  45. 0 episode-260/{chatter → chatter-after}/public/javascripts/jquery.min.js
  46. 0 episode-260/{chatter → chatter-after}/public/javascripts/rails.js
  47. 0 episode-260/{chatter → chatter-after}/public/robots.txt
  48. 0 episode-260/{chatter → chatter-after}/public/stylesheets/.gitkeep
  49. 0 episode-260/{chatter → chatter-after}/public/stylesheets/application.css
  50. 0 episode-260/{chatter → chatter-after}/script/rails
  51. 0 episode-260/{chatter → chatter-after}/test/fixtures/message.yml
  52. 0 episode-260/{chatter → chatter-after}/test/functional/messages_controller_test.rb
  53. 0 episode-260/{chatter → chatter-after}/test/performance/browsing_test.rb
  54. 0 episode-260/{chatter → chatter-after}/test/test_helper.rb
  55. 0 episode-260/{chatter → chatter-after}/test/unit/messages_test.rb
  56. 0 episode-260/{chatter/lib/tasks → chatter-after/vendor/plugins}/.gitkeep
  57. +1 −2 episode-260/chatter-before/Gemfile
  58. +0 −2 episode-260/chatter-before/Gemfile.lock
  59. 0 episode-260/chatter-before/{chatter → }/README
  60. +1 −6 episode-260/chatter-before/app/controllers/messages_controller.rb
  61. 0 episode-260/chatter-before/{chatter → }/app/views/messages/_message.html.erb
  62. 0 episode-260/chatter-before/{chatter → }/app/views/messages/create.js.erb
  63. +2 −7 episode-260/chatter-before/app/views/messages/index.html.erb
  64. +0 −4 episode-260/chatter-before/chatter/.gitignore
  65. +0 −6 episode-260/chatter-before/chatter/Gemfile
  66. +0 −79 episode-260/chatter-before/chatter/Gemfile.lock
  67. +0 −7 episode-260/chatter-before/chatter/Rakefile
  68. +0 −3 episode-260/chatter-before/chatter/app/controllers/application_controller.rb
  69. +0 −9 episode-260/chatter-before/chatter/app/controllers/messages_controller.rb
  70. +0 −2 episode-260/chatter-before/chatter/app/helpers/application_helper.rb
  71. +0 −23 episode-260/chatter-before/chatter/app/helpers/error_messages_helper.rb
  72. +0 −22 episode-260/chatter-before/chatter/app/helpers/layout_helper.rb
  73. +0 −2 episode-260/chatter-before/chatter/app/helpers/messages_helper.rb
  74. +0 −3 episode-260/chatter-before/chatter/app/models/message.rb
  75. +0 −19 episode-260/chatter-before/chatter/app/views/layouts/application.html.erb
  76. +0 −10 episode-260/chatter-before/chatter/app/views/messages/index.html.erb
  77. +0 −4 episode-260/chatter-before/chatter/config.ru
  78. +0 −42 episode-260/chatter-before/chatter/config/application.rb
  79. +0 −6 episode-260/chatter-before/chatter/config/boot.rb
  80. +0 −22 episode-260/chatter-before/chatter/config/database.yml
  81. +0 −5 episode-260/chatter-before/chatter/config/environment.rb
  82. +0 −26 episode-260/chatter-before/chatter/config/environments/development.rb
  83. +0 −49 episode-260/chatter-before/chatter/config/environments/production.rb
  84. +0 −35 episode-260/chatter-before/chatter/config/environments/test.rb
  85. +0 −7 episode-260/chatter-before/chatter/config/initializers/backtrace_silencers.rb
  86. +0 −10 episode-260/chatter-before/chatter/config/initializers/inflections.rb
  87. +0 −5 episode-260/chatter-before/chatter/config/initializers/mime_types.rb
  88. +0 −7 episode-260/chatter-before/chatter/config/initializers/secret_token.rb
  89. +0 −8 episode-260/chatter-before/chatter/config/initializers/session_store.rb
  90. +0 −5 episode-260/chatter-before/chatter/config/locales/en.yml
  91. +0 −4 episode-260/chatter-before/chatter/config/routes.rb
  92. +0 −12 episode-260/chatter-before/chatter/db/migrate/20110403022903_create_messages.rb
  93. +0 −21 episode-260/chatter-before/chatter/db/schema.rb
  94. +0 −7 episode-260/chatter-before/chatter/db/seeds.rb
  95. +0 −2 episode-260/chatter-before/chatter/doc/README_FOR_APP
  96. 0 episode-260/chatter-before/chatter/lib/tasks/.gitkeep
  97. +0 −26 episode-260/chatter-before/chatter/public/404.html
  98. +0 −26 episode-260/chatter-before/chatter/public/422.html
  99. +0 −26 episode-260/chatter-before/chatter/public/500.html
  100. 0 episode-260/chatter-before/chatter/public/favicon.ico
  101. BIN episode-260/chatter-before/chatter/public/images/rails.png
  102. +0 −2 episode-260/chatter-before/chatter/public/javascripts/application.js
  103. +0 −8,374 episode-260/chatter-before/chatter/public/javascripts/jquery.js
  104. +0 −16 episode-260/chatter-before/chatter/public/javascripts/jquery.min.js
  105. +0 −159 episode-260/chatter-before/chatter/public/javascripts/rails.js
  106. +0 −5 episode-260/chatter-before/chatter/public/robots.txt
  107. 0 episode-260/chatter-before/chatter/public/stylesheets/.gitkeep
  108. +0 −102 episode-260/chatter-before/chatter/public/stylesheets/application.css
  109. +0 −6 episode-260/chatter-before/chatter/script/rails
  110. +0 −5 episode-260/chatter-before/chatter/test/fixtures/message.yml
  111. +0 −20 episode-260/chatter-before/chatter/test/functional/messages_controller_test.rb
  112. +0 −9 episode-260/chatter-before/chatter/test/performance/browsing_test.rb
  113. +0 −13 episode-260/chatter-before/chatter/test/test_helper.rb
  114. +0 −7 episode-260/chatter-before/chatter/test/unit/messages_test.rb
  115. 0 episode-260/chatter-before/chatter/vendor/plugins/.gitkeep
@@ -2,6 +2,5 @@ source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem 'sqlite3'
-gem 'jquery-rails'
gem 'nifty-generators'
-gem "mocha", :group => :test
+gem 'jquery-rails'
@@ -42,7 +42,6 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
- mocha (0.9.12)
nifty-generators (0.4.6)
polyglot (0.3.1)
rack (1.2.2)
@@ -75,7 +74,6 @@ PLATFORMS
DEPENDENCIES
jquery-rails
- mocha
nifty-generators
rails (= 3.0.5)
sqlite3
@@ -4,11 +4,6 @@ def index
end
def create
- @message = Message.new(params[:message])
- if @message.save
- redirect_to messages_url
- else
- render :action => 'new'
- end
+ @message = Message.create!(params[:message])
end
end
@@ -1,15 +1,10 @@
<% title "Chat" %>
<ul id="chat">
-<% for message in @messages %>
- <li>
- <span class="created_at"><%= message.created_at.strftime("%H:%M") %></span>
- <%= message.content %>
- </li>
-<% end %>
+ <%= render @messages %>
</ul>
-<%= form_for Message.new do |f| %>
+<%= form_for Message.new, :remote => true do |f| %>
<%= f.text_field :content %>
<%= f.submit "Send" %>
<% end %>
@@ -1,4 +0,0 @@
-.bundle
-db/*.sqlite3
-log/*.log
-tmp/
@@ -1,6 +0,0 @@
-source 'http://rubygems.org'
-
-gem 'rails', '3.0.5'
-gem 'sqlite3'
-gem 'nifty-generators'
-gem 'jquery-rails'
@@ -1,79 +0,0 @@
-GEM
- remote: http://rubygems.org/
- specs:
- abstract (1.0.0)
- actionmailer (3.0.5)
- actionpack (= 3.0.5)
- mail (~> 2.2.15)
- actionpack (3.0.5)
- activemodel (= 3.0.5)
- activesupport (= 3.0.5)
- builder (~> 2.1.2)
- erubis (~> 2.6.6)
- i18n (~> 0.4)
- rack (~> 1.2.1)
- rack-mount (~> 0.6.13)
- rack-test (~> 0.5.7)
- tzinfo (~> 0.3.23)
- activemodel (3.0.5)
- activesupport (= 3.0.5)
- builder (~> 2.1.2)
- i18n (~> 0.4)
- activerecord (3.0.5)
- activemodel (= 3.0.5)
- activesupport (= 3.0.5)
- arel (~> 2.0.2)
- tzinfo (~> 0.3.23)
- activeresource (3.0.5)
- activemodel (= 3.0.5)
- activesupport (= 3.0.5)
- activesupport (3.0.5)
- arel (2.0.9)
- builder (2.1.2)
- erubis (2.6.6)
- abstract (>= 1.0.0)
- i18n (0.5.0)
- jquery-rails (0.2.7)
- rails (~> 3.0)
- thor (~> 0.14.4)
- mail (2.2.15)
- activesupport (>= 2.3.6)
- i18n (>= 0.4.0)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
- mime-types (1.16)
- nifty-generators (0.4.6)
- polyglot (0.3.1)
- rack (1.2.2)
- rack-mount (0.6.14)
- rack (>= 1.0.0)
- rack-test (0.5.7)
- rack (>= 1.0)
- rails (3.0.5)
- actionmailer (= 3.0.5)
- actionpack (= 3.0.5)
- activerecord (= 3.0.5)
- activeresource (= 3.0.5)
- activesupport (= 3.0.5)
- bundler (~> 1.0)
- railties (= 3.0.5)
- railties (3.0.5)
- actionpack (= 3.0.5)
- activesupport (= 3.0.5)
- rake (>= 0.8.7)
- thor (~> 0.14.4)
- rake (0.8.7)
- sqlite3 (1.3.3)
- thor (0.14.6)
- treetop (1.4.9)
- polyglot (>= 0.3.1)
- tzinfo (0.3.26)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- jquery-rails
- nifty-generators
- rails (= 3.0.5)
- sqlite3
@@ -1,7 +0,0 @@
-# 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__)
-require 'rake'
-
-Chatter::Application.load_tasks
@@ -1,3 +0,0 @@
-class ApplicationController < ActionController::Base
- protect_from_forgery
-end
@@ -1,9 +0,0 @@
-class MessagesController < ApplicationController
- def index
- @messages = Message.all
- end
-
- def create
- @message = Message.create!(params[:message])
- end
-end
@@ -1,2 +0,0 @@
-module ApplicationHelper
-end
@@ -1,23 +0,0 @@
-module ErrorMessagesHelper
- # Render error messages for the given objects. The :message and :header_message options are allowed.
- def error_messages_for(*objects)
- options = objects.extract_options!
- options[:header_message] ||= I18n.t(:"activerecord.errors.header", :default => "Invalid Fields")
- options[:message] ||= I18n.t(:"activerecord.errors.message", :default => "Correct the following errors and try again.")
- messages = objects.compact.map { |o| o.errors.full_messages }.flatten
- unless messages.empty?
- content_tag(:div, :class => "error_messages") do
- list_items = messages.map { |msg| content_tag(:li, msg) }
- content_tag(:h2, options[:header_message]) + content_tag(:p, options[:message]) + content_tag(:ul, list_items.join.html_safe)
- end
- end
- end
-
- module FormBuilderAdditions
- def error_messages(options = {})
- @template.error_messages_for(@object, options)
- end
- end
-end
-
-ActionView::Helpers::FormBuilder.send(:include, ErrorMessagesHelper::FormBuilderAdditions)
@@ -1,22 +0,0 @@
-# These helper methods can be called in your template to set variables to be used in the layout
-# This module should be included in all views globally,
-# to do so you may need to add this line to your ApplicationController
-# helper :layout
-module LayoutHelper
- def title(page_title, show_title = true)
- content_for(:title) { h(page_title.to_s) }
- @show_title = show_title
- end
-
- def show_title?
- @show_title
- end
-
- def stylesheet(*args)
- content_for(:head) { stylesheet_link_tag(*args) }
- end
-
- def javascript(*args)
- content_for(:head) { javascript_include_tag(*args) }
- end
-end
@@ -1,2 +0,0 @@
-module MessagesHelper
-end
@@ -1,3 +0,0 @@
-class Message < ActiveRecord::Base
- attr_accessible :content
-end
@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title><%= content_for?(:title) ? yield(:title) : "Untitled" %></title>
- <%= stylesheet_link_tag "application" %>
- <%= javascript_include_tag :defaults %>
- <%= csrf_meta_tag %>
- <%= yield(:head) %>
- </head>
- <body>
- <div id="container">
- <% flash.each do |name, msg| %>
- <%= content_tag :div, msg, :id => "flash_#{name}" %>
- <% end %>
- <%= content_tag :h1, yield(:title) if show_title? %>
- <%= yield %>
- </div>
- </body>
-</html>
@@ -1,10 +0,0 @@
-<% title "Chat" %>
-
-<ul id="chat">
- <%= render @messages %>
-</ul>
-
-<%= form_for Message.new, :remote => true do |f| %>
- <%= f.text_field :content %>
- <%= f.submit "Send" %>
-<% end %>
@@ -1,4 +0,0 @@
-# This file is used by Rack-based servers to start the application.
-
-require ::File.expand_path('../config/environment', __FILE__)
-run Chatter::Application
@@ -1,42 +0,0 @@
-require File.expand_path('../boot', __FILE__)
-
-require "rails/all"
-
-# If you have a Gemfile, require the gems listed there, including any gems
-# you've limited to :test, :development, or :production.
-Bundler.require(:default, Rails.env) if defined?(Bundler)
-
-module Chatter
- 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 = "Pacific 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
-
- # JavaScript files you want as :defaults (application.js is always included).
- # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
-
- # 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]
- end
-end
@@ -1,6 +0,0 @@
-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'])
@@ -1,22 +0,0 @@
-# SQLite version 3.x
-# gem install 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
@@ -1,5 +0,0 @@
-# Load the rails application
-require File.expand_path('../application', __FILE__)
-
-# Initialize the rails application
-Chatter::Application.initialize!
@@ -1,26 +0,0 @@
-Chatter::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 webserver 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_view.debug_rjs = 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
-end
-
Oops, something went wrong.

0 comments on commit de20fd9

Please sign in to comment.