From 0232543e0d885902b5b3ea9c4cf0638d76583a35 Mon Sep 17 00:00:00 2001
From: Aditya Sanghi
Date: Tue, 17 Apr 2012 15:31:05 +0530
Subject: stamp out ruby-debug19 with extreme prejudice :)
---
guides/code/getting_started/Gemfile | 2 +-
guides/code/getting_started/README.rdoc | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
(limited to 'guides/code')
diff --git a/guides/code/getting_started/Gemfile b/guides/code/getting_started/Gemfile
index 768985070c..582a176a44 100644
--- a/guides/code/getting_started/Gemfile
+++ b/guides/code/getting_started/Gemfile
@@ -35,4 +35,4 @@ gem 'jquery-rails'
# gem 'capistrano'
# To use debugger
-# gem 'ruby-debug19', :require => 'ruby-debug'
+# gem 'debugger'
diff --git a/guides/code/getting_started/README.rdoc b/guides/code/getting_started/README.rdoc
index d2014bd35f..465c180c44 100644
--- a/guides/code/getting_started/README.rdoc
+++ b/guides/code/getting_started/README.rdoc
@@ -86,8 +86,8 @@ programming in general.
Debugger support is available through the debugger command when you start your
Mongrel or WEBrick server with --debugger. This means that you can break out of
execution at any point in the code, investigate and change the model, and then,
-resume execution! You need to install ruby-debug19 to run the server in debugging
-mode. With gems, use sudo gem install ruby-debug19. Example:
+resume execution! You need to install debugger to run the server in debugging
+mode. With gems, use sudo gem install debugger. Example:
class WeblogController < ActionController::Base
def index
--
cgit v1.2.3
From 6f80ea2aec83523640b505ddd5b6e87f0100a85b Mon Sep 17 00:00:00 2001
From: Aditya Sanghi
Date: Wed, 18 Apr 2012 00:48:59 +0530
Subject: review changes for #5875
---
guides/code/getting_started/README.rdoc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/code')
diff --git a/guides/code/getting_started/README.rdoc b/guides/code/getting_started/README.rdoc
index 465c180c44..06cc2635b7 100644
--- a/guides/code/getting_started/README.rdoc
+++ b/guides/code/getting_started/README.rdoc
@@ -87,7 +87,7 @@ Debugger support is available through the debugger command when you start your
Mongrel or WEBrick server with --debugger. This means that you can break out of
execution at any point in the code, investigate and change the model, and then,
resume execution! You need to install debugger to run the server in debugging
-mode. With gems, use sudo gem install debugger. Example:
+mode. With gems, use gem install debugger. Example:
class WeblogController < ActionController::Base
def index
--
cgit v1.2.3
From 67ede880550836ce9f66164c56c8afeb397a54da Mon Sep 17 00:00:00 2001
From: Aditya Sanghi
Date: Wed, 18 Apr 2012 02:24:44 +0530
Subject: another attempt at the language
---
guides/code/getting_started/README.rdoc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides/code')
diff --git a/guides/code/getting_started/README.rdoc b/guides/code/getting_started/README.rdoc
index 06cc2635b7..3c6b480bcf 100644
--- a/guides/code/getting_started/README.rdoc
+++ b/guides/code/getting_started/README.rdoc
@@ -86,7 +86,7 @@ programming in general.
Debugger support is available through the debugger command when you start your
Mongrel or WEBrick server with --debugger. This means that you can break out of
execution at any point in the code, investigate and change the model, and then,
-resume execution! You need to install debugger to run the server in debugging
+resume execution! You need to install a debugger to run the server in debugging
mode. With gems, use gem install debugger. Example:
class WeblogController < ActionController::Base
--
cgit v1.2.3
From e44b845b0ec8b3e459ba1386fb355cf25bbf7656 Mon Sep 17 00:00:00 2001
From: Oscar Del Ben
Date: Thu, 19 Apr 2012 10:37:03 +0200
Subject: Regenerate Gemfile for getting started guide
---
guides/code/getting_started/Gemfile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'guides/code')
diff --git a/guides/code/getting_started/Gemfile b/guides/code/getting_started/Gemfile
index 768985070c..ab4e34b2d0 100644
--- a/guides/code/getting_started/Gemfile
+++ b/guides/code/getting_started/Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
-gem 'rails', '3.2.0'
+gem 'rails', '3.2.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
@@ -15,7 +15,7 @@ group :assets do
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
- # gem 'therubyracer'
+ # gem 'therubyracer', :platform => :ruby
gem 'uglifier', '>= 1.0.3'
end
@@ -28,7 +28,7 @@ gem 'jquery-rails'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
-# Use unicorn as the web server
+# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
--
cgit v1.2.3
From f6d5036dd620da48624ce32494f63aa4221b05d5 Mon Sep 17 00:00:00 2001
From: Oscar Del Ben
Date: Fri, 20 Apr 2012 10:43:50 +0200
Subject: Adapt "Getting started guide" code sample
---
.../app/controllers/posts_controller.rb | 76 +---------------------
guides/code/getting_started/app/models/post.rb | 5 +-
.../getting_started/app/views/posts/_form.html.erb | 45 ++++---------
.../getting_started/app/views/posts/new.html.erb | 2 +-
guides/code/getting_started/config/routes.rb | 11 ++--
.../db/migrate/20110901012504_create_posts.rb | 11 ----
.../db/migrate/20120420083127_create_posts.rb | 10 +++
guides/code/getting_started/db/schema.rb | 17 +++--
.../code/getting_started/test/fixtures/posts.yml | 6 +-
9 files changed, 45 insertions(+), 138 deletions(-)
delete mode 100644 guides/code/getting_started/db/migrate/20110901012504_create_posts.rb
create mode 100644 guides/code/getting_started/db/migrate/20120420083127_create_posts.rb
(limited to 'guides/code')
diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb
index 1581d4eb16..3373443b16 100644
--- a/guides/code/getting_started/app/controllers/posts_controller.rb
+++ b/guides/code/getting_started/app/controllers/posts_controller.rb
@@ -1,84 +1,12 @@
class PostsController < ApplicationController
- http_basic_authenticate_with :name => "dhh", :password => "secret", :except => :index
- # GET /posts
- # GET /posts.json
- def index
- @posts = Post.all
- respond_to do |format|
- format.html # index.html.erb
- format.json { render json: @posts }
- end
- end
-
- # GET /posts/1
- # GET /posts/1.json
- def show
- @post = Post.find(params[:id])
-
- respond_to do |format|
- format.html # show.html.erb
- format.json { render json: @post }
- end
- end
-
- # GET /posts/new
- # GET /posts/new.json
def new
- @post = Post.new
-
- respond_to do |format|
- format.html # new.html.erb
- format.json { render json: @post }
- end
- end
-
- # GET /posts/1/edit
- def edit
- @post = Post.find(params[:id])
end
- # POST /posts
- # POST /posts.json
def create
@post = Post.new(params[:post])
- respond_to do |format|
- if @post.save
- format.html { redirect_to @post, notice: 'Post was successfully created.' }
- format.json { render json: @post, status: :created, location: @post }
- else
- format.html { render action: "new" }
- format.json { render json: @post.errors, status: :unprocessable_entity }
- end
- end
- end
-
- # PUT /posts/1
- # PUT /posts/1.json
- def update
- @post = Post.find(params[:id])
-
- respond_to do |format|
- if @post.update_attributes(params[:post])
- format.html { redirect_to @post, notice: 'Post was successfully updated.' }
- format.json { head :no_content }
- else
- format.html { render action: "edit" }
- format.json { render json: @post.errors, status: :unprocessable_entity }
- end
- end
- end
-
- # DELETE /posts/1
- # DELETE /posts/1.json
- def destroy
- @post = Post.find(params[:id])
- @post.destroy
-
- respond_to do |format|
- format.html { redirect_to posts_url }
- format.json { head :no_content }
- end
+ @post.save
+ redirect_to :action => :index
end
end
diff --git a/guides/code/getting_started/app/models/post.rb b/guides/code/getting_started/app/models/post.rb
index 61c2b5ae44..4b809110b6 100644
--- a/guides/code/getting_started/app/models/post.rb
+++ b/guides/code/getting_started/app/models/post.rb
@@ -1,11 +1,10 @@
class Post < ActiveRecord::Base
- validates :name, :presence => true
validates :title, :presence => true,
:length => { :minimum => 5 }
-
+
has_many :comments, :dependent => :destroy
has_many :tags
-
+
accepts_nested_attributes_for :tags, :allow_destroy => :true,
:reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }
end
diff --git a/guides/code/getting_started/app/views/posts/_form.html.erb b/guides/code/getting_started/app/views/posts/_form.html.erb
index e27da7f413..51fa3f4f12 100644
--- a/guides/code/getting_started/app/views/posts/_form.html.erb
+++ b/guides/code/getting_started/app/views/posts/_form.html.erb
@@ -1,32 +1,15 @@
-<% @post.tags.build %>
-<%= form_for(@post) do |post_form| %>
- <% if @post.errors.any? %>
-
-
<%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:
-
- <% @post.errors.full_messages.each do |msg| %>
- - <%= msg %>
- <% end %>
-
-
- <% end %>
-
-
- <%= post_form.label :name %>
- <%= post_form.text_field :name %>
-
-
- <%= post_form.label :title %>
- <%= post_form.text_field :title %>
-
-
- <%= post_form.label :content %>
- <%= post_form.text_area :content %>
-
- Tags
- <%= render :partial => 'tags/form',
- :locals => {:form => post_form} %>
-
- <%= post_form.submit %>
-
+<%= form_for :post, :url => { :action => :create } do |f| %>
+
+ <%= f.label :title %>
+ <%= f.text_field :title %>
+
+
+
+ <%= f.label :text %>
+ <%= f.text_area :text %>
+
+
+
+ <%= f.submit %>
+
<% end %>
diff --git a/guides/code/getting_started/app/views/posts/new.html.erb b/guides/code/getting_started/app/views/posts/new.html.erb
index 36ad7421f9..5d6482f880 100644
--- a/guides/code/getting_started/app/views/posts/new.html.erb
+++ b/guides/code/getting_started/app/views/posts/new.html.erb
@@ -2,4 +2,4 @@
<%= render 'form' %>
-<%= link_to 'Back', posts_path %>
+<%#= link_to 'Back', posts_path %>
diff --git a/guides/code/getting_started/config/routes.rb b/guides/code/getting_started/config/routes.rb
index b048ac68f1..98b1a6dcc8 100644
--- a/guides/code/getting_started/config/routes.rb
+++ b/guides/code/getting_started/config/routes.rb
@@ -1,9 +1,10 @@
Blog::Application.routes.draw do
- resources :posts do
- resources :comments
- end
+ # resources :posts do
+ # resources :comments
+ # end
- get "home/index"
+ get "posts/new"
+ post "posts/create"
# The priority is based upon order of creation:
# first created -> highest priority.
@@ -55,7 +56,7 @@ Blog::Application.routes.draw do
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
root :to => "home#index"
-
+
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
diff --git a/guides/code/getting_started/db/migrate/20110901012504_create_posts.rb b/guides/code/getting_started/db/migrate/20110901012504_create_posts.rb
deleted file mode 100644
index d45a961523..0000000000
--- a/guides/code/getting_started/db/migrate/20110901012504_create_posts.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreatePosts < ActiveRecord::Migration
- def change
- create_table :posts do |t|
- t.string :name
- t.string :title
- t.text :content
-
- t.timestamps
- end
- end
-end
diff --git a/guides/code/getting_started/db/migrate/20120420083127_create_posts.rb b/guides/code/getting_started/db/migrate/20120420083127_create_posts.rb
new file mode 100644
index 0000000000..602bef31ab
--- /dev/null
+++ b/guides/code/getting_started/db/migrate/20120420083127_create_posts.rb
@@ -0,0 +1,10 @@
+class CreatePosts < ActiveRecord::Migration
+ def change
+ create_table :posts do |t|
+ t.string :title
+ t.text :text
+
+ t.timestamps
+ end
+ end
+end
diff --git a/guides/code/getting_started/db/schema.rb b/guides/code/getting_started/db/schema.rb
index 9db4fbe4b6..cfb56ca9b9 100644
--- a/guides/code/getting_started/db/schema.rb
+++ b/guides/code/getting_started/db/schema.rb
@@ -11,31 +11,30 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110901013701) do
+ActiveRecord::Schema.define(:version => 20120420083127) do
create_table "comments", :force => true do |t|
t.string "commenter"
t.text "body"
t.integer "post_id"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
add_index "comments", ["post_id"], :name => "index_comments_on_post_id"
create_table "posts", :force => true do |t|
- t.string "name"
t.string "title"
- t.text "content"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.text "text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "tags", :force => true do |t|
t.string "name"
t.integer "post_id"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
add_index "tags", ["post_id"], :name => "index_tags_on_post_id"
diff --git a/guides/code/getting_started/test/fixtures/posts.yml b/guides/code/getting_started/test/fixtures/posts.yml
index 8b0f75a33d..e1edfd385e 100644
--- a/guides/code/getting_started/test/fixtures/posts.yml
+++ b/guides/code/getting_started/test/fixtures/posts.yml
@@ -1,11 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
one:
- name: MyString
title: MyString
- content: MyText
+ text: MyText
two:
- name: MyString
title: MyString
- content: MyText
+ text: MyText
--
cgit v1.2.3
From dbb4c4ddb601e06fef37f63d644a5297f3292c2a Mon Sep 17 00:00:00 2001
From: Oscar Del Ben
Date: Fri, 20 Apr 2012 10:47:38 +0200
Subject: New Getting started guide wont have tags
---
guides/code/getting_started/app/helpers/posts_helper.rb | 3 ---
guides/code/getting_started/app/models/post.rb | 1 -
guides/code/getting_started/app/models/tag.rb | 3 ---
guides/code/getting_started/app/views/posts/show.html.erb | 7 +------
guides/code/getting_started/app/views/tags/_form.html.erb | 12 ------------
.../getting_started/db/migrate/20110901013701_create_tags.rb | 11 -----------
6 files changed, 1 insertion(+), 36 deletions(-)
delete mode 100644 guides/code/getting_started/app/models/tag.rb
delete mode 100644 guides/code/getting_started/app/views/tags/_form.html.erb
delete mode 100644 guides/code/getting_started/db/migrate/20110901013701_create_tags.rb
(limited to 'guides/code')
diff --git a/guides/code/getting_started/app/helpers/posts_helper.rb b/guides/code/getting_started/app/helpers/posts_helper.rb
index b6e8e67894..a7b8cec898 100644
--- a/guides/code/getting_started/app/helpers/posts_helper.rb
+++ b/guides/code/getting_started/app/helpers/posts_helper.rb
@@ -1,5 +1,2 @@
module PostsHelper
- def join_tags(post)
- post.tags.map { |t| t.name }.join(", ")
- end
end
diff --git a/guides/code/getting_started/app/models/post.rb b/guides/code/getting_started/app/models/post.rb
index 4b809110b6..e77e607f3f 100644
--- a/guides/code/getting_started/app/models/post.rb
+++ b/guides/code/getting_started/app/models/post.rb
@@ -3,7 +3,6 @@ class Post < ActiveRecord::Base
:length => { :minimum => 5 }
has_many :comments, :dependent => :destroy
- has_many :tags
accepts_nested_attributes_for :tags, :allow_destroy => :true,
:reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }
diff --git a/guides/code/getting_started/app/models/tag.rb b/guides/code/getting_started/app/models/tag.rb
deleted file mode 100644
index 30992e8ba9..0000000000
--- a/guides/code/getting_started/app/models/tag.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-class Tag < ActiveRecord::Base
- belongs_to :post
-end
diff --git a/guides/code/getting_started/app/views/posts/show.html.erb b/guides/code/getting_started/app/views/posts/show.html.erb
index da78a9527b..3445fd8779 100644
--- a/guides/code/getting_started/app/views/posts/show.html.erb
+++ b/guides/code/getting_started/app/views/posts/show.html.erb
@@ -14,12 +14,7 @@
Content:
<%= @post.content %>
-
-
- Tags:
- <%= join_tags(@post) %>
-
-
+
Comments
<%= render @post.comments %>
diff --git a/guides/code/getting_started/app/views/tags/_form.html.erb b/guides/code/getting_started/app/views/tags/_form.html.erb
deleted file mode 100644
index 7e424b0e20..0000000000
--- a/guides/code/getting_started/app/views/tags/_form.html.erb
+++ /dev/null
@@ -1,12 +0,0 @@
-<%= form.fields_for :tags do |tag_form| %>
-
- <%= tag_form.label :name, 'Tag:' %>
- <%= tag_form.text_field :name %>
-
- <% unless tag_form.object.nil? || tag_form.object.new_record? %>
-
- <%= tag_form.label :_destroy, 'Remove:' %>
- <%= tag_form.check_box :_destroy %>
-
- <% end %>
-<% end %>
diff --git a/guides/code/getting_started/db/migrate/20110901013701_create_tags.rb b/guides/code/getting_started/db/migrate/20110901013701_create_tags.rb
deleted file mode 100644
index cf95b1c3d0..0000000000
--- a/guides/code/getting_started/db/migrate/20110901013701_create_tags.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreateTags < ActiveRecord::Migration
- def change
- create_table :tags do |t|
- t.string :name
- t.references :post
-
- t.timestamps
- end
- add_index :tags, :post_id
- end
-end
--
cgit v1.2.3
From 2e2afc0ac64190261df4b05428afddea96c8628c Mon Sep 17 00:00:00 2001
From: Oscar Del Ben
Date: Fri, 20 Apr 2012 12:06:47 +0200
Subject: Add show action in getting started guide
---
.../app/controllers/posts_controller.rb | 7 +++++-
guides/code/getting_started/app/models/post.rb | 3 ---
.../getting_started/app/views/posts/show.html.erb | 25 ++++------------------
guides/code/getting_started/config/routes.rb | 1 +
4 files changed, 11 insertions(+), 25 deletions(-)
(limited to 'guides/code')
diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb
index 3373443b16..f9181f98c6 100644
--- a/guides/code/getting_started/app/controllers/posts_controller.rb
+++ b/guides/code/getting_started/app/controllers/posts_controller.rb
@@ -1,5 +1,10 @@
class PostsController < ApplicationController
+
+ def show
+ @post = Post.find(params[:id])
+ end
+
def new
end
@@ -7,6 +12,6 @@ class PostsController < ApplicationController
@post = Post.new(params[:post])
@post.save
- redirect_to :action => :index
+ redirect_to :action => :show, :id => @post.id
end
end
diff --git a/guides/code/getting_started/app/models/post.rb b/guides/code/getting_started/app/models/post.rb
index e77e607f3f..21387340b0 100644
--- a/guides/code/getting_started/app/models/post.rb
+++ b/guides/code/getting_started/app/models/post.rb
@@ -3,7 +3,4 @@ class Post < ActiveRecord::Base
:length => { :minimum => 5 }
has_many :comments, :dependent => :destroy
-
- accepts_nested_attributes_for :tags, :allow_destroy => :true,
- :reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }
end
diff --git a/guides/code/getting_started/app/views/posts/show.html.erb b/guides/code/getting_started/app/views/posts/show.html.erb
index 3445fd8779..6207babdf0 100644
--- a/guides/code/getting_started/app/views/posts/show.html.erb
+++ b/guides/code/getting_started/app/views/posts/show.html.erb
@@ -1,26 +1,9 @@
-<%= notice %>
-
- Name:
- <%= @post.name %>
-
-
-
- Title:
+ Title:
<%= @post.title %>
-
+
- Content:
- <%= @post.content %>
+ Text:
+ <%= @post.text %>
-
-Comments
-<%= render @post.comments %>
-
-Add a comment:
-<%= render "comments/form" %>
-
-
-<%= link_to 'Edit Post', edit_post_path(@post) %> |
-<%= link_to 'Back to Posts', posts_path %> |
diff --git a/guides/code/getting_started/config/routes.rb b/guides/code/getting_started/config/routes.rb
index 98b1a6dcc8..7210b559bb 100644
--- a/guides/code/getting_started/config/routes.rb
+++ b/guides/code/getting_started/config/routes.rb
@@ -5,6 +5,7 @@ Blog::Application.routes.draw do
get "posts/new"
post "posts/create"
+ get "posts/:id" => "posts#show"
# The priority is based upon order of creation:
# first created -> highest priority.
--
cgit v1.2.3
From e7e72aa253d9cb3bef786a955794986d1f3ff871 Mon Sep 17 00:00:00 2001
From: Oscar Del Ben
Date: Fri, 20 Apr 2012 12:53:18 +0200
Subject: Add index and links section to Getting started guide
---
.../getting_started/app/controllers/home_controller.rb | 2 +-
.../app/controllers/posts_controller.rb | 3 +++
guides/code/getting_started/app/helpers/home_helper.rb | 2 +-
.../code/getting_started/app/views/home/index.html.erb | 2 --
.../getting_started/app/views/posts/index.html.erb | 18 +++++-------------
.../code/getting_started/app/views/posts/new.html.erb | 2 +-
.../code/getting_started/app/views/posts/show.html.erb | 2 ++
.../getting_started/app/views/welcome/index.html.erb | 2 ++
guides/code/getting_started/config/routes.rb | 3 ++-
.../test/functional/home_controller_test.rb | 2 +-
10 files changed, 18 insertions(+), 20 deletions(-)
delete mode 100644 guides/code/getting_started/app/views/home/index.html.erb
create mode 100644 guides/code/getting_started/app/views/welcome/index.html.erb
(limited to 'guides/code')
diff --git a/guides/code/getting_started/app/controllers/home_controller.rb b/guides/code/getting_started/app/controllers/home_controller.rb
index 6cc31c1ca3..309b70441e 100644
--- a/guides/code/getting_started/app/controllers/home_controller.rb
+++ b/guides/code/getting_started/app/controllers/home_controller.rb
@@ -1,4 +1,4 @@
-class HomeController < ApplicationController
+class WelcomeController < ApplicationController
def index
end
diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb
index f9181f98c6..e4d83dd279 100644
--- a/guides/code/getting_started/app/controllers/posts_controller.rb
+++ b/guides/code/getting_started/app/controllers/posts_controller.rb
@@ -1,5 +1,8 @@
class PostsController < ApplicationController
+ def index
+ @posts = Post.all
+ end
def show
@post = Post.find(params[:id])
diff --git a/guides/code/getting_started/app/helpers/home_helper.rb b/guides/code/getting_started/app/helpers/home_helper.rb
index 23de56ac60..eeead45fc9 100644
--- a/guides/code/getting_started/app/helpers/home_helper.rb
+++ b/guides/code/getting_started/app/helpers/home_helper.rb
@@ -1,2 +1,2 @@
-module HomeHelper
+module WelcomeHelper
end
diff --git a/guides/code/getting_started/app/views/home/index.html.erb b/guides/code/getting_started/app/views/home/index.html.erb
deleted file mode 100644
index bb4f3dcd1f..0000000000
--- a/guides/code/getting_started/app/views/home/index.html.erb
+++ /dev/null
@@ -1,2 +0,0 @@
-Hello, Rails!
-<%= link_to "My Blog", posts_path %>
diff --git a/guides/code/getting_started/app/views/posts/index.html.erb b/guides/code/getting_started/app/views/posts/index.html.erb
index 45dee1b25f..455a74b17f 100644
--- a/guides/code/getting_started/app/views/posts/index.html.erb
+++ b/guides/code/getting_started/app/views/posts/index.html.erb
@@ -1,27 +1,19 @@
Listing posts
+<%= link_to 'New post', :action => :new %>
+
- Name |
Title |
- Content |
- |
- |
+ Text |
|
<% @posts.each do |post| %>
- <%= post.name %> |
<%= post.title %> |
- <%= post.content %> |
- <%= link_to 'Show', post %> |
- <%= link_to 'Edit', edit_post_path(post) %> |
- <%= link_to 'Destroy', post, confirm: 'Are you sure?', method: :delete %> |
+ <%= post.text %> |
+ <%= link_to 'Show', :action => :show, :id => post.id %>
|
<% end %>
-
-
-
-<%= link_to 'New Post', new_post_path %>
diff --git a/guides/code/getting_started/app/views/posts/new.html.erb b/guides/code/getting_started/app/views/posts/new.html.erb
index 5d6482f880..ce9523a721 100644
--- a/guides/code/getting_started/app/views/posts/new.html.erb
+++ b/guides/code/getting_started/app/views/posts/new.html.erb
@@ -2,4 +2,4 @@
<%= render 'form' %>
-<%#= link_to 'Back', posts_path %>
+<%= link_to 'Back', :action => :index %>
diff --git a/guides/code/getting_started/app/views/posts/show.html.erb b/guides/code/getting_started/app/views/posts/show.html.erb
index 6207babdf0..a79fadfe4c 100644
--- a/guides/code/getting_started/app/views/posts/show.html.erb
+++ b/guides/code/getting_started/app/views/posts/show.html.erb
@@ -7,3 +7,5 @@
Text:
<%= @post.text %>
+
+<%= link_to 'Back', :action => :index %>
diff --git a/guides/code/getting_started/app/views/welcome/index.html.erb b/guides/code/getting_started/app/views/welcome/index.html.erb
new file mode 100644
index 0000000000..e04680ea7e
--- /dev/null
+++ b/guides/code/getting_started/app/views/welcome/index.html.erb
@@ -0,0 +1,2 @@
+Hello, Rails!
+<%= link_to "My Blog", :controller => "posts" %>
diff --git a/guides/code/getting_started/config/routes.rb b/guides/code/getting_started/config/routes.rb
index 7210b559bb..10009a35cf 100644
--- a/guides/code/getting_started/config/routes.rb
+++ b/guides/code/getting_started/config/routes.rb
@@ -3,6 +3,7 @@ Blog::Application.routes.draw do
# resources :comments
# end
+ get "posts" => "posts#index"
get "posts/new"
post "posts/create"
get "posts/:id" => "posts#show"
@@ -56,7 +57,7 @@ Blog::Application.routes.draw do
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
- root :to => "home#index"
+ root :to => "welcome#index"
# See how all your routes lay out with "rake routes"
diff --git a/guides/code/getting_started/test/functional/home_controller_test.rb b/guides/code/getting_started/test/functional/home_controller_test.rb
index 0d9bb47c3e..dff8e9d2c5 100644
--- a/guides/code/getting_started/test/functional/home_controller_test.rb
+++ b/guides/code/getting_started/test/functional/home_controller_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'
-class HomeControllerTest < ActionController::TestCase
+class WelcomeControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
--
cgit v1.2.3
From 504ba12e8cd256b08a43f8ee56c6e2b0272ce6cc Mon Sep 17 00:00:00 2001
From: Oscar Del Ben
Date: Sat, 21 Apr 2012 12:01:33 +0200
Subject: Add model validation section to Getting Started guide
---
.../app/assets/javascripts/comments.js.coffee | 3 --
.../app/assets/javascripts/home.js.coffee | 3 --
.../app/assets/javascripts/posts.js.coffee | 3 --
.../app/assets/stylesheets/comments.css.scss | 3 --
.../app/assets/stylesheets/home.css.scss | 3 --
.../app/assets/stylesheets/posts.css.scss | 3 --
.../app/assets/stylesheets/scaffolds.css.scss | 56 ----------------------
.../app/controllers/posts_controller.rb | 7 ++-
.../vendor/assets/stylesheets/.gitkeep | 0
9 files changed, 5 insertions(+), 76 deletions(-)
delete mode 100644 guides/code/getting_started/app/assets/javascripts/comments.js.coffee
delete mode 100644 guides/code/getting_started/app/assets/javascripts/home.js.coffee
delete mode 100644 guides/code/getting_started/app/assets/javascripts/posts.js.coffee
delete mode 100644 guides/code/getting_started/app/assets/stylesheets/comments.css.scss
delete mode 100644 guides/code/getting_started/app/assets/stylesheets/home.css.scss
delete mode 100644 guides/code/getting_started/app/assets/stylesheets/posts.css.scss
delete mode 100644 guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss
delete mode 100644 guides/code/getting_started/vendor/assets/stylesheets/.gitkeep
(limited to 'guides/code')
diff --git a/guides/code/getting_started/app/assets/javascripts/comments.js.coffee b/guides/code/getting_started/app/assets/javascripts/comments.js.coffee
deleted file mode 100644
index 761567942f..0000000000
--- a/guides/code/getting_started/app/assets/javascripts/comments.js.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-# 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/
diff --git a/guides/code/getting_started/app/assets/javascripts/home.js.coffee b/guides/code/getting_started/app/assets/javascripts/home.js.coffee
deleted file mode 100644
index 761567942f..0000000000
--- a/guides/code/getting_started/app/assets/javascripts/home.js.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-# 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/
diff --git a/guides/code/getting_started/app/assets/javascripts/posts.js.coffee b/guides/code/getting_started/app/assets/javascripts/posts.js.coffee
deleted file mode 100644
index 761567942f..0000000000
--- a/guides/code/getting_started/app/assets/javascripts/posts.js.coffee
+++ /dev/null
@@ -1,3 +0,0 @@
-# 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/
diff --git a/guides/code/getting_started/app/assets/stylesheets/comments.css.scss b/guides/code/getting_started/app/assets/stylesheets/comments.css.scss
deleted file mode 100644
index e730912783..0000000000
--- a/guides/code/getting_started/app/assets/stylesheets/comments.css.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-// Place all the styles related to the Comments controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/guides/code/getting_started/app/assets/stylesheets/home.css.scss b/guides/code/getting_started/app/assets/stylesheets/home.css.scss
deleted file mode 100644
index f0ddc6846a..0000000000
--- a/guides/code/getting_started/app/assets/stylesheets/home.css.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-// 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/
diff --git a/guides/code/getting_started/app/assets/stylesheets/posts.css.scss b/guides/code/getting_started/app/assets/stylesheets/posts.css.scss
deleted file mode 100644
index ed4dfd10f2..0000000000
--- a/guides/code/getting_started/app/assets/stylesheets/posts.css.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-// Place all the styles related to the Posts controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss b/guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss
deleted file mode 100644
index 05188f08ed..0000000000
--- a/guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss
+++ /dev/null
@@ -1,56 +0,0 @@
-body {
- background-color: #fff;
- color: #333;
- font-family: verdana, arial, helvetica, sans-serif;
- font-size: 13px;
- line-height: 18px; }
-
-p, ol, ul, td {
- font-family: verdana, arial, helvetica, sans-serif;
- font-size: 13px;
- line-height: 18px; }
-
-pre {
- background-color: #eee;
- padding: 10px;
- font-size: 11px; }
-
-a {
- color: #000;
- &:visited {
- color: #666; }
- &:hover {
- color: #fff;
- background-color: #000; } }
-
-div {
- &.field, &.actions {
- margin-bottom: 10px; } }
-
-#notice {
- color: green; }
-
-.field_with_errors {
- padding: 2px;
- background-color: red;
- display: table; }
-
-#error_explanation {
- width: 450px;
- border: 2px solid red;
- padding: 7px;
- padding-bottom: 0;
- margin-bottom: 20px;
- background-color: #f0f0f0;
- h2 {
- text-align: left;
- font-weight: bold;
- padding: 5px 5px 5px 15px;
- font-size: 12px;
- margin: -7px;
- margin-bottom: 0px;
- background-color: #c00;
- color: #fff; }
- ul li {
- font-size: 12px;
- list-style: square; } }
diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb
index e4d83dd279..2ad69a9bcf 100644
--- a/guides/code/getting_started/app/controllers/posts_controller.rb
+++ b/guides/code/getting_started/app/controllers/posts_controller.rb
@@ -14,7 +14,10 @@ class PostsController < ApplicationController
def create
@post = Post.new(params[:post])
- @post.save
- redirect_to :action => :show, :id => @post.id
+ if @post.save
+ redirect_to :action => :show, :id => @post.id
+ else
+ render 'new'
+ end
end
end
diff --git a/guides/code/getting_started/vendor/assets/stylesheets/.gitkeep b/guides/code/getting_started/vendor/assets/stylesheets/.gitkeep
deleted file mode 100644
index e69de29bb2..0000000000
--
cgit v1.2.3
From 3da2b530aff28d4ea0272e36578188bb6869cbcc Mon Sep 17 00:00:00 2001
From: Oscar Del Ben
Date: Sat, 21 Apr 2012 12:17:51 +0200
Subject: Add validation code to getting started guide and improve validation
section
---
.../code/getting_started/app/controllers/posts_controller.rb | 1 +
guides/code/getting_started/app/views/posts/_form.html.erb | 10 ++++++++++
2 files changed, 11 insertions(+)
(limited to 'guides/code')
diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb
index 2ad69a9bcf..947cd2a767 100644
--- a/guides/code/getting_started/app/controllers/posts_controller.rb
+++ b/guides/code/getting_started/app/controllers/posts_controller.rb
@@ -9,6 +9,7 @@ class PostsController < ApplicationController
end
def new
+ @post = Post.new
end
def create
diff --git a/guides/code/getting_started/app/views/posts/_form.html.erb b/guides/code/getting_started/app/views/posts/_form.html.erb
index 51fa3f4f12..18cb29f335 100644
--- a/guides/code/getting_started/app/views/posts/_form.html.erb
+++ b/guides/code/getting_started/app/views/posts/_form.html.erb
@@ -1,4 +1,14 @@
<%= form_for :post, :url => { :action => :create } do |f| %>
+ <% if @post.errors.any? %>
+
+
<%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:
+
+ <% @post.errors.full_messages.each do |msg| %>
+ - <%= msg %>
+ <% end %>
+
+
+ <% end %>
<%= f.label :title %>
<%= f.text_field :title %>
--
cgit v1.2.3
From 5acb345a86584e3c9c4b5a81c4499c767393c89a Mon Sep 17 00:00:00 2001
From: Oscar Del Ben
Date: Tue, 24 Apr 2012 12:30:24 +0200
Subject: Fix some code in getting started guide
---
guides/code/getting_started/app/helpers/home_helper.rb | 2 --
guides/code/getting_started/app/helpers/welcome_helper.rb | 2 ++
2 files changed, 2 insertions(+), 2 deletions(-)
delete mode 100644 guides/code/getting_started/app/helpers/home_helper.rb
create mode 100644 guides/code/getting_started/app/helpers/welcome_helper.rb
(limited to 'guides/code')
diff --git a/guides/code/getting_started/app/helpers/home_helper.rb b/guides/code/getting_started/app/helpers/home_helper.rb
deleted file mode 100644
index eeead45fc9..0000000000
--- a/guides/code/getting_started/app/helpers/home_helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module WelcomeHelper
-end
diff --git a/guides/code/getting_started/app/helpers/welcome_helper.rb b/guides/code/getting_started/app/helpers/welcome_helper.rb
new file mode 100644
index 0000000000..eeead45fc9
--- /dev/null
+++ b/guides/code/getting_started/app/helpers/welcome_helper.rb
@@ -0,0 +1,2 @@
+module WelcomeHelper
+end
--
cgit v1.2.3
From f0de7172a6e1a52bf122578954d805a36a488d27 Mon Sep 17 00:00:00 2001
From: Oscar Del Ben
Date: Tue, 24 Apr 2012 14:21:07 +0200
Subject: Add update post section to getting started guide
---
.../getting_started/app/controllers/posts_controller.rb | 14 ++++++++++++++
guides/code/getting_started/app/views/posts/_form.html.erb | 2 +-
guides/code/getting_started/app/views/posts/edit.html.erb | 3 +--
guides/code/getting_started/app/views/posts/index.html.erb | 2 ++
guides/code/getting_started/app/views/posts/show.html.erb | 1 +
guides/code/getting_started/config/routes.rb | 2 ++
6 files changed, 21 insertions(+), 3 deletions(-)
(limited to 'guides/code')
diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb
index 947cd2a767..fc71e9b4e8 100644
--- a/guides/code/getting_started/app/controllers/posts_controller.rb
+++ b/guides/code/getting_started/app/controllers/posts_controller.rb
@@ -21,4 +21,18 @@ class PostsController < ApplicationController
render 'new'
end
end
+
+ def edit
+ @post = Post.find(params[:id])
+ end
+
+ def update
+ @post = Post.find(params[:id])
+
+ if @post.update_attributes(params[:post])
+ redirect_to :action => :show, :id => @post.id
+ else
+ render 'edit'
+ end
+ end
end
diff --git a/guides/code/getting_started/app/views/posts/_form.html.erb b/guides/code/getting_started/app/views/posts/_form.html.erb
index 18cb29f335..46ec257b91 100644
--- a/guides/code/getting_started/app/views/posts/_form.html.erb
+++ b/guides/code/getting_started/app/views/posts/_form.html.erb
@@ -1,4 +1,4 @@
-<%= form_for :post, :url => { :action => :create } do |f| %>
+<%= form_for :post, :url => { :action => :update, :id => @post.id }, :method => :put do |f| %>
<% if @post.errors.any? %>
<%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:
diff --git a/guides/code/getting_started/app/views/posts/edit.html.erb b/guides/code/getting_started/app/views/posts/edit.html.erb
index 720580236b..911a48569d 100644
--- a/guides/code/getting_started/app/views/posts/edit.html.erb
+++ b/guides/code/getting_started/app/views/posts/edit.html.erb
@@ -2,5 +2,4 @@
<%= render 'form' %>
-<%= link_to 'Show', @post %> |
-<%= link_to 'Back', posts_path %>
+<%= link_to 'Back', :action => :index %>
diff --git a/guides/code/getting_started/app/views/posts/index.html.erb b/guides/code/getting_started/app/views/posts/index.html.erb
index 455a74b17f..3ba7091c15 100644
--- a/guides/code/getting_started/app/views/posts/index.html.erb
+++ b/guides/code/getting_started/app/views/posts/index.html.erb
@@ -7,6 +7,7 @@
Title |
Text |
|
+
|
<% @posts.each do |post| %>
@@ -14,6 +15,7 @@
<%= post.title %> |
<%= post.text %> |
<%= link_to 'Show', :action => :show, :id => post.id %>
+ | <%= link_to 'Edit', :action => :edit, :id => post.id %>
<% end %>
diff --git a/guides/code/getting_started/app/views/posts/show.html.erb b/guides/code/getting_started/app/views/posts/show.html.erb
index a79fadfe4c..aea28cd5a2 100644
--- a/guides/code/getting_started/app/views/posts/show.html.erb
+++ b/guides/code/getting_started/app/views/posts/show.html.erb
@@ -9,3 +9,4 @@
<%= link_to 'Back', :action => :index %>
+| <%= link_to 'Edit', :action => :edit, :id => @post.id %>
diff --git a/guides/code/getting_started/config/routes.rb b/guides/code/getting_started/config/routes.rb
index 10009a35cf..b0973c62d5 100644
--- a/guides/code/getting_started/config/routes.rb
+++ b/guides/code/getting_started/config/routes.rb
@@ -7,6 +7,8 @@ Blog::Application.routes.draw do
get "posts/new"
post "posts/create"
get "posts/:id" => "posts#show"
+ get "posts/:id/edit" => "posts#edit"
+ put "posts/:id/update" => "posts#update"
# The priority is based upon order of creation:
# first created -> highest priority.
--
cgit v1.2.3
From d6c831c198baee2542a070c62f1608f88fe60e34 Mon Sep 17 00:00:00 2001
From: Aditya Sanghi
Date: Tue, 24 Apr 2012 21:56:41 -0500
Subject: and one more time
---
guides/code/getting_started/README.rdoc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'guides/code')
diff --git a/guides/code/getting_started/README.rdoc b/guides/code/getting_started/README.rdoc
index 3c6b480bcf..b5d7b6436b 100644
--- a/guides/code/getting_started/README.rdoc
+++ b/guides/code/getting_started/README.rdoc
@@ -86,8 +86,8 @@ programming in general.
Debugger support is available through the debugger command when you start your
Mongrel or WEBrick server with --debugger. This means that you can break out of
execution at any point in the code, investigate and change the model, and then,
-resume execution! You need to install a debugger to run the server in debugging
-mode. With gems, use gem install debugger. Example:
+resume execution! You need to install the 'debugger' gem to run the server in debugging
+mode. Add gem 'debugger' to your Gemfile and run bundle to install it. Example:
class WeblogController < ActionController::Base
def index
--
cgit v1.2.3
From ee4e7125a61c703332a8d591a0aee917ba828e62 Mon Sep 17 00:00:00 2001
From: Oscar Del Ben
Date: Wed, 25 Apr 2012 15:43:10 +0200
Subject: Add partials section to getting started guide
---
guides/code/getting_started/app/views/posts/_form.html.erb | 2 +-
guides/code/getting_started/config/routes.rb | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
(limited to 'guides/code')
diff --git a/guides/code/getting_started/app/views/posts/_form.html.erb b/guides/code/getting_started/app/views/posts/_form.html.erb
index 46ec257b91..b35ea2f237 100644
--- a/guides/code/getting_started/app/views/posts/_form.html.erb
+++ b/guides/code/getting_started/app/views/posts/_form.html.erb
@@ -1,4 +1,4 @@
-<%= form_for :post, :url => { :action => :update, :id => @post.id }, :method => :put do |f| %>
+<%= form_for @post do |f| %>
<% if @post.errors.any? %>
<%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:
diff --git a/guides/code/getting_started/config/routes.rb b/guides/code/getting_started/config/routes.rb
index b0973c62d5..02ca24e95a 100644
--- a/guides/code/getting_started/config/routes.rb
+++ b/guides/code/getting_started/config/routes.rb
@@ -6,9 +6,9 @@ Blog::Application.routes.draw do
get "posts" => "posts#index"
get "posts/new"
post "posts/create"
- get "posts/:id" => "posts#show"
+ get "posts/:id" => "posts#show", :as => :post
get "posts/:id/edit" => "posts#edit"
- put "posts/:id/update" => "posts#update"
+ put "posts/:id" => "posts#update"
# The priority is based upon order of creation:
# first created -> highest priority.
--
cgit v1.2.3
From f4447607f20c420d9c341b19064c07d5b7aa6cee Mon Sep 17 00:00:00 2001
From: Oscar Del Ben
Date: Fri, 27 Apr 2012 14:21:02 +0200
Subject: Add delete post section to Getting Started guide
---
guides/code/getting_started/app/controllers/posts_controller.rb | 7 +++++++
guides/code/getting_started/app/views/posts/index.html.erb | 2 ++
guides/code/getting_started/config/routes.rb | 1 +
3 files changed, 10 insertions(+)
(limited to 'guides/code')
diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb
index fc71e9b4e8..85d2c1de47 100644
--- a/guides/code/getting_started/app/controllers/posts_controller.rb
+++ b/guides/code/getting_started/app/controllers/posts_controller.rb
@@ -35,4 +35,11 @@ class PostsController < ApplicationController
render 'edit'
end
end
+
+ def destroy
+ @post = Post.find(params[:id])
+ @post.destroy
+
+ redirect_to :action => :index
+ end
end
diff --git a/guides/code/getting_started/app/views/posts/index.html.erb b/guides/code/getting_started/app/views/posts/index.html.erb
index 3ba7091c15..7b72720d50 100644
--- a/guides/code/getting_started/app/views/posts/index.html.erb
+++ b/guides/code/getting_started/app/views/posts/index.html.erb
@@ -8,6 +8,7 @@
Text |
|
|
+ |
<% @posts.each do |post| %>
@@ -16,6 +17,7 @@
<%= post.text %> |
<%= link_to 'Show', :action => :show, :id => post.id %>
| <%= link_to 'Edit', :action => :edit, :id => post.id %>
+ | <%= link_to 'Destroy', { :action => :destroy, :id => post.id }, :method => :delete, :confirm => 'Are you sure?' %>
<% end %>
diff --git a/guides/code/getting_started/config/routes.rb b/guides/code/getting_started/config/routes.rb
index 02ca24e95a..6095a05a58 100644
--- a/guides/code/getting_started/config/routes.rb
+++ b/guides/code/getting_started/config/routes.rb
@@ -9,6 +9,7 @@ Blog::Application.routes.draw do
get "posts/:id" => "posts#show", :as => :post
get "posts/:id/edit" => "posts#edit"
put "posts/:id" => "posts#update"
+ delete "posts/:id" => "posts#destroy"
# The priority is based upon order of creation:
# first created -> highest priority.
--
cgit v1.2.3
From 943410197cca4235212ca0fc409820378a40890c Mon Sep 17 00:00:00 2001
From: Oscar Del Ben
Date: Sat, 28 Apr 2012 11:44:50 +0200
Subject: Add REST section to getting started guide
---
guides/code/getting_started/config/routes.rb | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
(limited to 'guides/code')
diff --git a/guides/code/getting_started/config/routes.rb b/guides/code/getting_started/config/routes.rb
index 6095a05a58..5fb85de766 100644
--- a/guides/code/getting_started/config/routes.rb
+++ b/guides/code/getting_started/config/routes.rb
@@ -1,15 +1,6 @@
Blog::Application.routes.draw do
- # resources :posts do
- # resources :comments
- # end
- get "posts" => "posts#index"
- get "posts/new"
- post "posts/create"
- get "posts/:id" => "posts#show", :as => :post
- get "posts/:id/edit" => "posts#edit"
- put "posts/:id" => "posts#update"
- delete "posts/:id" => "posts#destroy"
+ resources :posts
# The priority is based upon order of creation:
# first created -> highest priority.
--
cgit v1.2.3
| |