aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/examples/blog_controller.cgi
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-09-09 17:55:26 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-09-09 17:55:26 +0000
commit955fa6151aabfbe0626c84005cb0cad27da3e5c3 (patch)
tree8d9175f86572bbf00f5e3f021e7b6c7b3804e3f2 /actionpack/examples/blog_controller.cgi
parent73c70836515879f69a152535f3ab411acc3317b8 (diff)
downloadrails-955fa6151aabfbe0626c84005cb0cad27da3e5c3.tar.gz
rails-955fa6151aabfbe0626c84005cb0cad27da3e5c3.tar.bz2
rails-955fa6151aabfbe0626c84005cb0cad27da3e5c3.zip
The examples are outdated and misleading
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7424 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/examples/blog_controller.cgi')
-rwxr-xr-xactionpack/examples/blog_controller.cgi53
1 files changed, 0 insertions, 53 deletions
diff --git a/actionpack/examples/blog_controller.cgi b/actionpack/examples/blog_controller.cgi
deleted file mode 100755
index 506afad62f..0000000000
--- a/actionpack/examples/blog_controller.cgi
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/local/bin/ruby
-
-$:.unshift(File.dirname(__FILE__) + "/../lib")
-
-require "action_controller"
-
-Post = Struct.new("Post", :title, :body)
-
-class BlogController < ActionController::Base
- before_filter :initialize_session_storage
-
- def index
- @posts = @session["posts"]
-
- render_template <<-"EOF"
- <html><body>
- <%= flash["alert"] %>
- <h1>Posts</h1>
- <% @posts.each do |post| %>
- <p><b><%= post.title %></b><br /><%= post.body %></p>
- <% end %>
-
- <h1>Create post</h1>
- <form action="create">
- Title: <input type="text" name="post[title]"><br>
- Body: <textarea name="post[body]"></textarea><br>
- <input type="submit" value="save">
- </form>
-
- </body></html>
- EOF
- end
-
- def create
- @session["posts"].unshift(Post.new(params[:post][:title], params[:post][:body]))
- flash["alert"] = "New post added!"
- redirect_to :action => "index"
- end
-
- private
- def initialize_session_storage
- @session["posts"] = [] if @session["posts"].nil?
- end
-end
-
-ActionController::Base.view_paths = [ File.dirname(__FILE__) ]
-# ActionController::Base.logger = Logger.new("debug.log") # Remove first comment to turn on logging in current dir
-
-begin
- BlogController.process_cgi(CGI.new) if $0 == __FILE__
-rescue => e
- CGI.new.out { "#{e.class}: #{e.message}" }
-end