aboutsummaryrefslogtreecommitdiffstats
path: root/guides/code
diff options
context:
space:
mode:
Diffstat (limited to 'guides/code')
-rw-r--r--guides/code/getting_started/Gemfile10
-rw-r--r--guides/code/getting_started/Gemfile.lock85
-rw-r--r--guides/code/getting_started/app/assets/javascripts/articles.js.coffee (renamed from guides/code/getting_started/app/assets/javascripts/posts.js.coffee)0
-rw-r--r--guides/code/getting_started/app/assets/stylesheets/articles.css.scss (renamed from guides/code/getting_started/app/assets/stylesheets/posts.css.scss)2
-rw-r--r--guides/code/getting_started/app/controllers/articles_controller.rb53
-rw-r--r--guides/code/getting_started/app/controllers/comments_controller.rb12
-rw-r--r--guides/code/getting_started/app/controllers/posts_controller.rb53
-rw-r--r--guides/code/getting_started/app/helpers/articles_helper.rb2
-rw-r--r--guides/code/getting_started/app/helpers/posts_helper.rb2
-rw-r--r--guides/code/getting_started/app/models/article.rb (renamed from guides/code/getting_started/app/models/post.rb)4
-rw-r--r--guides/code/getting_started/app/models/comment.rb2
-rw-r--r--guides/code/getting_started/app/views/articles/_form.html.erb (renamed from guides/code/getting_started/app/views/posts/_form.html.erb)10
-rw-r--r--guides/code/getting_started/app/views/articles/edit.html.erb (renamed from guides/code/getting_started/app/views/posts/edit.html.erb)6
-rw-r--r--guides/code/getting_started/app/views/articles/index.html.erb21
-rw-r--r--guides/code/getting_started/app/views/articles/new.html.erb (renamed from guides/code/getting_started/app/views/posts/new.html.erb)6
-rw-r--r--guides/code/getting_started/app/views/articles/show.html.erb18
-rw-r--r--guides/code/getting_started/app/views/comments/_comment.html.erb4
-rw-r--r--guides/code/getting_started/app/views/comments/_form.html.erb2
-rw-r--r--guides/code/getting_started/app/views/posts/index.html.erb21
-rw-r--r--guides/code/getting_started/app/views/posts/show.html.erb18
-rw-r--r--guides/code/getting_started/app/views/welcome/index.html.erb4
-rw-r--r--guides/code/getting_started/config/environments/development.rb8
-rw-r--r--guides/code/getting_started/config/routes.rb2
-rw-r--r--guides/code/getting_started/db/migrate/20130122042648_create_articles.rb (renamed from guides/code/getting_started/db/migrate/20130122042648_create_posts.rb)4
-rw-r--r--guides/code/getting_started/db/migrate/20130122045842_create_comments.rb2
-rw-r--r--guides/code/getting_started/db/schema.rb18
-rw-r--r--guides/code/getting_started/test/controllers/articles_controller_test.rb (renamed from guides/code/getting_started/test/controllers/posts_controller_test.rb)2
-rw-r--r--guides/code/getting_started/test/fixtures/articles.yml (renamed from guides/code/getting_started/test/fixtures/posts.yml)0
-rw-r--r--guides/code/getting_started/test/fixtures/comments.yml4
-rw-r--r--guides/code/getting_started/test/helpers/articles_helper_test.rb4
-rw-r--r--guides/code/getting_started/test/helpers/posts_helper_test.rb4
-rw-r--r--guides/code/getting_started/test/models/article_test.rb (renamed from guides/code/getting_started/test/models/post_test.rb)2
-rw-r--r--guides/code/getting_started/test/test_helper.rb3
33 files changed, 196 insertions, 192 deletions
diff --git a/guides/code/getting_started/Gemfile b/guides/code/getting_started/Gemfile
index c3d7e96c4d..13a0ef44a9 100644
--- a/guides/code/getting_started/Gemfile
+++ b/guides/code/getting_started/Gemfile
@@ -2,11 +2,11 @@ source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
-gem 'rails', '4.1.0'
-# Use sqlite3 as the database for Active Record
+gem 'rails', '4.1.1'
+# Use SQLite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
-gem 'sass-rails', '~> 4.0.1'
+gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
@@ -14,7 +14,7 @@ gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
-# Use jquery as the JavaScript library
+# Use jQuery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
@@ -29,7 +29,7 @@ gem 'spring', group: :development
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
-# Use unicorn as the app server
+# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
diff --git a/guides/code/getting_started/Gemfile.lock b/guides/code/getting_started/Gemfile.lock
index a2ab76c908..f26cf58e6a 100644
--- a/guides/code/getting_started/Gemfile.lock
+++ b/guides/code/getting_started/Gemfile.lock
@@ -1,34 +1,33 @@
GEM
remote: https://rubygems.org/
specs:
- actionmailer (4.1.0)
- actionpack (= 4.1.0)
- actionview (= 4.1.0)
+ actionmailer (4.1.1)
+ actionpack (= 4.1.1)
+ actionview (= 4.1.1)
mail (~> 2.5.4)
- actionpack (4.1.0)
- actionview (= 4.1.0)
- activesupport (= 4.1.0)
+ actionpack (4.1.1)
+ actionview (= 4.1.1)
+ activesupport (= 4.1.1)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
- actionview (4.1.0)
- activesupport (= 4.1.0)
+ actionview (4.1.1)
+ activesupport (= 4.1.1)
builder (~> 3.1)
erubis (~> 2.7.0)
- activemodel (4.1.0)
- activesupport (= 4.1.0)
+ activemodel (4.1.1)
+ activesupport (= 4.1.1)
builder (~> 3.1)
- activerecord (4.1.0)
- activemodel (= 4.1.0)
- activesupport (= 4.1.0)
+ activerecord (4.1.1)
+ activemodel (= 4.1.1)
+ activesupport (= 4.1.1)
arel (~> 5.0.0)
- activesupport (4.1.0)
+ activesupport (4.1.1)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
- arel (5.0.0)
- atomic (1.1.14)
+ arel (5.0.1.20140414130214)
builder (3.2.2)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
@@ -52,52 +51,52 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
- minitest (5.2.1)
- multi_json (1.8.4)
- polyglot (0.3.3)
+ minitest (5.3.4)
+ multi_json (1.10.1)
+ polyglot (0.3.4)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
- rails (4.1.0)
- actionmailer (= 4.1.0)
- actionpack (= 4.1.0)
- actionview (= 4.1.0)
- activemodel (= 4.1.0)
- activerecord (= 4.1.0)
- activesupport (= 4.1.0)
+ rails (4.1.1)
+ actionmailer (= 4.1.1)
+ actionpack (= 4.1.1)
+ actionview (= 4.1.1)
+ activemodel (= 4.1.1)
+ activerecord (= 4.1.1)
+ activesupport (= 4.1.1)
bundler (>= 1.3.0, < 2.0)
- railties (= 4.1.0)
- sprockets-rails (~> 2.0.0)
- railties (4.1.0)
- actionpack (= 4.1.0)
- activesupport (= 4.1.0)
+ railties (= 4.1.1)
+ sprockets-rails (~> 2.0)
+ railties (4.1.1)
+ actionpack (= 4.1.1)
+ activesupport (= 4.1.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
- rake (10.1.1)
+ rake (10.3.2)
rdoc (4.1.1)
json (~> 1.4)
- sass (3.2.13)
- sass-rails (4.0.1)
+ sass (3.2.19)
+ sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0)
- sass (>= 3.1.10)
- sprockets-rails (~> 2.0.0)
+ sass (~> 3.2.0)
+ sprockets (~> 2.8, <= 2.11.0)
+ sprockets-rails (~> 2.0)
sdoc (0.4.0)
json (~> 1.8)
rdoc (~> 4.0, < 5.0)
spring (1.0.0)
- sprockets (2.10.1)
+ sprockets (2.11.0)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sprockets-rails (2.0.1)
+ sprockets-rails (2.1.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
sqlite3 (1.3.8)
- thor (0.18.1)
- thread_safe (0.1.3)
- atomic
+ thor (0.19.1)
+ thread_safe (0.3.3)
tilt (1.4.1)
treetop (1.4.15)
polyglot
@@ -117,8 +116,8 @@ DEPENDENCIES
coffee-rails (~> 4.0.0)
jbuilder (~> 2.0)
jquery-rails
- rails (= 4.1.0)
- sass-rails (~> 4.0.1)
+ rails (= 4.1.1)
+ sass-rails (~> 4.0.3)
sdoc (~> 0.4.0)
spring
sqlite3
diff --git a/guides/code/getting_started/app/assets/javascripts/posts.js.coffee b/guides/code/getting_started/app/assets/javascripts/articles.js.coffee
index 24f83d18bb..24f83d18bb 100644
--- a/guides/code/getting_started/app/assets/javascripts/posts.js.coffee
+++ b/guides/code/getting_started/app/assets/javascripts/articles.js.coffee
diff --git a/guides/code/getting_started/app/assets/stylesheets/posts.css.scss b/guides/code/getting_started/app/assets/stylesheets/articles.css.scss
index 1a7e15390c..cca548710d 100644
--- a/guides/code/getting_started/app/assets/stylesheets/posts.css.scss
+++ b/guides/code/getting_started/app/assets/stylesheets/articles.css.scss
@@ -1,3 +1,3 @@
-// Place all the styles related to the posts controller here.
+// Place all the styles related to the articles 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/controllers/articles_controller.rb b/guides/code/getting_started/app/controllers/articles_controller.rb
new file mode 100644
index 0000000000..275b84e8b7
--- /dev/null
+++ b/guides/code/getting_started/app/controllers/articles_controller.rb
@@ -0,0 +1,53 @@
+class ArticlesController < ApplicationController
+
+ http_basic_authenticate_with name: "dhh", password: "secret", except: [:index, :show]
+
+ def index
+ @articles = Article.all
+ end
+
+ def show
+ @article = Article.find(params[:id])
+ end
+
+ def edit
+ @article = Article.find(params[:id])
+ end
+
+ def update
+ @article = Article.find(params[:id])
+
+ if @article.update(article_params)
+ redirect_to action: :show, id: @article.id
+ else
+ render 'edit'
+ end
+ end
+
+ def new
+ @article = Article.new
+ end
+
+ def create
+ @article = Article.new(article_params)
+
+ if @article.save
+ redirect_to action: :show, id: @article.id
+ else
+ render 'new'
+ end
+ end
+
+ def destroy
+ @article = Article.find(params[:id])
+ @article.destroy
+
+ redirect_to action: :index
+ end
+
+ private
+
+ def article_params
+ params.require(:article).permit(:title, :text)
+ end
+end
diff --git a/guides/code/getting_started/app/controllers/comments_controller.rb b/guides/code/getting_started/app/controllers/comments_controller.rb
index b2d9bcdf7f..61813b1003 100644
--- a/guides/code/getting_started/app/controllers/comments_controller.rb
+++ b/guides/code/getting_started/app/controllers/comments_controller.rb
@@ -3,16 +3,16 @@ class CommentsController < ApplicationController
http_basic_authenticate_with name: "dhh", password: "secret", only: :destroy
def create
- @post = Post.find(params[:post_id])
- @comment = @post.comments.create(comment_params)
- redirect_to post_path(@post)
+ @article = Article.find(params[:article_id])
+ @comment = @article.comments.create(comment_params)
+ redirect_to article_path(@article)
end
def destroy
- @post = Post.find(params[:post_id])
- @comment = @post.comments.find(params[:id])
+ @article = Article.find(params[:article_id])
+ @comment = @article.comments.find(params[:id])
@comment.destroy
- redirect_to post_path(@post)
+ redirect_to article_path(@article)
end
private
diff --git a/guides/code/getting_started/app/controllers/posts_controller.rb b/guides/code/getting_started/app/controllers/posts_controller.rb
deleted file mode 100644
index 02689ad67b..0000000000
--- a/guides/code/getting_started/app/controllers/posts_controller.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-class PostsController < ApplicationController
-
- http_basic_authenticate_with name: "dhh", password: "secret", except: [:index, :show]
-
- def index
- @posts = Post.all
- end
-
- def show
- @post = Post.find(params[:id])
- end
-
- def edit
- @post = Post.find(params[:id])
- end
-
- def update
- @post = Post.find(params[:id])
-
- if @post.update(post_params)
- redirect_to action: :show, id: @post.id
- else
- render 'edit'
- end
- end
-
- def new
- @post = Post.new
- end
-
- def create
- @post = Post.new(post_params)
-
- if @post.save
- redirect_to action: :show, id: @post.id
- else
- render 'new'
- end
- end
-
- def destroy
- @post = Post.find(params[:id])
- @post.destroy
-
- redirect_to action: :index
- end
-
- private
-
- def post_params
- params.require(:post).permit(:title, :text)
- end
-end
diff --git a/guides/code/getting_started/app/helpers/articles_helper.rb b/guides/code/getting_started/app/helpers/articles_helper.rb
new file mode 100644
index 0000000000..2968277595
--- /dev/null
+++ b/guides/code/getting_started/app/helpers/articles_helper.rb
@@ -0,0 +1,2 @@
+module ArticlesHelper
+end
diff --git a/guides/code/getting_started/app/helpers/posts_helper.rb b/guides/code/getting_started/app/helpers/posts_helper.rb
deleted file mode 100644
index a7b8cec898..0000000000
--- a/guides/code/getting_started/app/helpers/posts_helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module PostsHelper
-end
diff --git a/guides/code/getting_started/app/models/post.rb b/guides/code/getting_started/app/models/article.rb
index 64e0d721fd..6fc7888be2 100644
--- a/guides/code/getting_started/app/models/post.rb
+++ b/guides/code/getting_started/app/models/article.rb
@@ -1,6 +1,6 @@
-class Post < ActiveRecord::Base
+class Article < ActiveRecord::Base
has_many :comments, dependent: :destroy
-
+
validates :title,
presence: true,
length: { minimum: 5 }
diff --git a/guides/code/getting_started/app/models/comment.rb b/guides/code/getting_started/app/models/comment.rb
index 4e76c5b5b0..e2646a324f 100644
--- a/guides/code/getting_started/app/models/comment.rb
+++ b/guides/code/getting_started/app/models/comment.rb
@@ -1,3 +1,3 @@
class Comment < ActiveRecord::Base
- belongs_to :post
+ belongs_to :article
end
diff --git a/guides/code/getting_started/app/views/posts/_form.html.erb b/guides/code/getting_started/app/views/articles/_form.html.erb
index f2f83585e1..87e3353ed2 100644
--- a/guides/code/getting_started/app/views/posts/_form.html.erb
+++ b/guides/code/getting_started/app/views/articles/_form.html.erb
@@ -1,10 +1,10 @@
-<%= form_for @post do |f| %>
- <% if @post.errors.any? %>
+<%= form_for @article do |f| %>
+ <% if @article.errors.any? %>
<div id="error_explanation">
- <h2><%= pluralize(@post.errors.count, "error") %> prohibited
- this post from being saved:</h2>
+ <h2><%= pluralize(@article.errors.count, "error") %> prohibited
+ this article from being saved:</h2>
<ul>
- <% @post.errors.full_messages.each do |msg| %>
+ <% @article.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
diff --git a/guides/code/getting_started/app/views/posts/edit.html.erb b/guides/code/getting_started/app/views/articles/edit.html.erb
index 393e7430d0..14236e2a98 100644
--- a/guides/code/getting_started/app/views/posts/edit.html.erb
+++ b/guides/code/getting_started/app/views/articles/edit.html.erb
@@ -1,5 +1,5 @@
-<h1>Edit post</h1>
-
+<h1>Edit article</h1>
+
<%= render 'form' %>
-
+
<%= link_to 'Back', action: :index %>
diff --git a/guides/code/getting_started/app/views/articles/index.html.erb b/guides/code/getting_started/app/views/articles/index.html.erb
new file mode 100644
index 0000000000..80e9c8c60c
--- /dev/null
+++ b/guides/code/getting_started/app/views/articles/index.html.erb
@@ -0,0 +1,21 @@
+<h1>Listing Articles</h1>
+<table>
+ <tr>
+ <th>Title</th>
+ <th>Text</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @articles.each do |article| %>
+ <tr>
+ <td><%= article.title %></td>
+ <td><%= article.text %></td>
+ <td><%= link_to 'Show', action: :show, id: article.id %></td>
+ <td><%= link_to 'Edit', action: :edit, id: article.id %></td>
+ <td><%= link_to 'Destroy', { action: :destroy, id: article.id },
+ method: :delete, data: { confirm: 'Are you sure?' } %></td>
+ </tr>
+<% end %>
+</table>
diff --git a/guides/code/getting_started/app/views/posts/new.html.erb b/guides/code/getting_started/app/views/articles/new.html.erb
index efa81038ec..652b1c9c0b 100644
--- a/guides/code/getting_started/app/views/posts/new.html.erb
+++ b/guides/code/getting_started/app/views/articles/new.html.erb
@@ -1,5 +1,5 @@
-<h1>New post</h1>
-
+<h1>New article</h1>
+
<%= render 'form' %>
-
+
<%= link_to 'Back', action: :index %>
diff --git a/guides/code/getting_started/app/views/articles/show.html.erb b/guides/code/getting_started/app/views/articles/show.html.erb
new file mode 100644
index 0000000000..6959c80bdb
--- /dev/null
+++ b/guides/code/getting_started/app/views/articles/show.html.erb
@@ -0,0 +1,18 @@
+<p>
+ <strong>Title:</strong>
+ <%= @article.title %>
+</p>
+
+<p>
+ <strong>Text:</strong>
+ <%= @article.text %>
+</p>
+
+<h2>Comments</h2>
+<%= render @article.comments %>
+
+<h2>Add a comment:</h2>
+<%= render "comments/form" %>
+
+<%= link_to 'Edit Article', edit_article_path(@article) %> |
+<%= link_to 'Back to Articles', articles_path %>
diff --git a/guides/code/getting_started/app/views/comments/_comment.html.erb b/guides/code/getting_started/app/views/comments/_comment.html.erb
index 593493339e..f7cbfaebfa 100644
--- a/guides/code/getting_started/app/views/comments/_comment.html.erb
+++ b/guides/code/getting_started/app/views/comments/_comment.html.erb
@@ -2,14 +2,14 @@
<strong>Commenter:</strong>
<%= comment.commenter %>
</p>
-
+
<p>
<strong>Comment:</strong>
<%= comment.body %>
</p>
<p>
- <%= link_to 'Destroy Comment', [comment.post, comment],
+ <%= link_to 'Destroy Comment', [comment.article, comment],
method: :delete,
data: { confirm: 'Are you sure?' } %>
</p>
diff --git a/guides/code/getting_started/app/views/comments/_form.html.erb b/guides/code/getting_started/app/views/comments/_form.html.erb
index 00cb3a08f0..5850c41a17 100644
--- a/guides/code/getting_started/app/views/comments/_form.html.erb
+++ b/guides/code/getting_started/app/views/comments/_form.html.erb
@@ -1,4 +1,4 @@
-<%= form_for([@post, @post.comments.build]) do |f| %>
+<%= form_for([@article, @article.comments.build]) do |f| %>
<p>
<%= f.label :commenter %><br />
<%= f.text_field :commenter %>
diff --git a/guides/code/getting_started/app/views/posts/index.html.erb b/guides/code/getting_started/app/views/posts/index.html.erb
deleted file mode 100644
index 7369f0396f..0000000000
--- a/guides/code/getting_started/app/views/posts/index.html.erb
+++ /dev/null
@@ -1,21 +0,0 @@
-<h1>Listing Posts</h1>
-<table>
- <tr>
- <th>Title</th>
- <th>Text</th>
- <th></th>
- <th></th>
- <th></th>
- </tr>
-
-<% @posts.each do |post| %>
- <tr>
- <td><%= post.title %></td>
- <td><%= post.text %></td>
- <td><%= link_to 'Show', action: :show, id: post.id %></td>
- <td><%= link_to 'Edit', action: :edit, id: post.id %></td>
- <td><%= link_to 'Destroy', { action: :destroy, id: post.id },
- method: :delete, data: { confirm: 'Are you sure?' } %></td>
- </tr>
-<% end %>
-</table>
diff --git a/guides/code/getting_started/app/views/posts/show.html.erb b/guides/code/getting_started/app/views/posts/show.html.erb
deleted file mode 100644
index e99e9edbb3..0000000000
--- a/guides/code/getting_started/app/views/posts/show.html.erb
+++ /dev/null
@@ -1,18 +0,0 @@
-<p>
- <strong>Title:</strong>
- <%= @post.title %>
-</p>
-
-<p>
- <strong>Text:</strong>
- <%= @post.text %>
-</p>
-
-<h2>Comments</h2>
-<%= render @post.comments %>
-
-<h2>Add a comment:</h2>
-<%= 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/app/views/welcome/index.html.erb b/guides/code/getting_started/app/views/welcome/index.html.erb
index 56be8dd3cc..1cabd0d217 100644
--- a/guides/code/getting_started/app/views/welcome/index.html.erb
+++ b/guides/code/getting_started/app/views/welcome/index.html.erb
@@ -1,4 +1,4 @@
<h1>Hello, Rails!</h1>
-<%= link_to "My Blog", controller: "posts" %>
-<%= link_to "New Post", new_post_path %>
+<%= link_to "My Blog", controller: "articles" %>
+<%= link_to "New Article", new_article_path %>
diff --git a/guides/code/getting_started/config/environments/development.rb b/guides/code/getting_started/config/environments/development.rb
index ae9ffe209a..5c1c600feb 100644
--- a/guides/code/getting_started/config/environments/development.rb
+++ b/guides/code/getting_started/config/environments/development.rb
@@ -27,4 +27,12 @@ Rails.application.configure do
# Debug mode disables concatenation and preprocessing of assets.
config.assets.debug = true
+
+ # Generate digests for assets URLs.
+ config.assets.digest = true
+
+ # Adds additional error checking when serving assets at runtime.
+ # Checks for improperly declared sprockets dependencies.
+ # Raises helpful error messages.
+ config.assets.raise_runtime_errors = true
end
diff --git a/guides/code/getting_started/config/routes.rb b/guides/code/getting_started/config/routes.rb
index 65d273b58d..97abca99b9 100644
--- a/guides/code/getting_started/config/routes.rb
+++ b/guides/code/getting_started/config/routes.rb
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
- resources :posts do
+ resources :articles do
resources :comments
end
diff --git a/guides/code/getting_started/db/migrate/20130122042648_create_posts.rb b/guides/code/getting_started/db/migrate/20130122042648_create_articles.rb
index 602bef31ab..6bb255e89f 100644
--- a/guides/code/getting_started/db/migrate/20130122042648_create_posts.rb
+++ b/guides/code/getting_started/db/migrate/20130122042648_create_articles.rb
@@ -1,6 +1,6 @@
-class CreatePosts < ActiveRecord::Migration
+class CreateArticles < ActiveRecord::Migration
def change
- create_table :posts do |t|
+ create_table :articles do |t|
t.string :title
t.text :text
diff --git a/guides/code/getting_started/db/migrate/20130122045842_create_comments.rb b/guides/code/getting_started/db/migrate/20130122045842_create_comments.rb
index 3e51f9c0f7..1f765839ac 100644
--- a/guides/code/getting_started/db/migrate/20130122045842_create_comments.rb
+++ b/guides/code/getting_started/db/migrate/20130122045842_create_comments.rb
@@ -3,7 +3,7 @@ class CreateComments < ActiveRecord::Migration
create_table :comments do |t|
t.string :commenter
t.text :body
- t.references :post, index: true
+ t.references :article, index: true
t.timestamps
end
diff --git a/guides/code/getting_started/db/schema.rb b/guides/code/getting_started/db/schema.rb
index 101fe712a1..be40f7cb0e 100644
--- a/guides/code/getting_started/db/schema.rb
+++ b/guides/code/getting_started/db/schema.rb
@@ -13,21 +13,21 @@
ActiveRecord::Schema.define(version: 20130122045842) do
- create_table "comments", force: true do |t|
- t.string "commenter"
- t.text "body"
- t.integer "post_id"
+ create_table "articles", force: true do |t|
+ t.string "title"
+ t.text "text"
t.datetime "created_at"
t.datetime "updated_at"
end
- add_index "comments", ["post_id"], name: "index_comments_on_post_id"
-
- create_table "posts", force: true do |t|
- t.string "title"
- t.text "text"
+ create_table "comments", force: true do |t|
+ t.string "commenter"
+ t.text "body"
+ t.integer "article_id"
t.datetime "created_at"
t.datetime "updated_at"
end
+ add_index "comments", ["article_id"], name: "index_comments_on_article_id"
+
end
diff --git a/guides/code/getting_started/test/controllers/posts_controller_test.rb b/guides/code/getting_started/test/controllers/articles_controller_test.rb
index 7a6ee4f1db..361aa0f47f 100644
--- a/guides/code/getting_started/test/controllers/posts_controller_test.rb
+++ b/guides/code/getting_started/test/controllers/articles_controller_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'
-class PostsControllerTest < ActionController::TestCase
+class ArticlesControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
diff --git a/guides/code/getting_started/test/fixtures/posts.yml b/guides/code/getting_started/test/fixtures/articles.yml
index 46b01c3bb4..46b01c3bb4 100644
--- a/guides/code/getting_started/test/fixtures/posts.yml
+++ b/guides/code/getting_started/test/fixtures/articles.yml
diff --git a/guides/code/getting_started/test/fixtures/comments.yml b/guides/code/getting_started/test/fixtures/comments.yml
index 9e409d8a61..05ad26f051 100644
--- a/guides/code/getting_started/test/fixtures/comments.yml
+++ b/guides/code/getting_started/test/fixtures/comments.yml
@@ -3,9 +3,9 @@
one:
commenter: MyString
body: MyText
- post_id:
+ article_id:
two:
commenter: MyString
body: MyText
- post_id:
+ article_id:
diff --git a/guides/code/getting_started/test/helpers/articles_helper_test.rb b/guides/code/getting_started/test/helpers/articles_helper_test.rb
new file mode 100644
index 0000000000..b341344067
--- /dev/null
+++ b/guides/code/getting_started/test/helpers/articles_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class ArticlesHelperTest < ActionView::TestCase
+end
diff --git a/guides/code/getting_started/test/helpers/posts_helper_test.rb b/guides/code/getting_started/test/helpers/posts_helper_test.rb
deleted file mode 100644
index 48549c2ea1..0000000000
--- a/guides/code/getting_started/test/helpers/posts_helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class PostsHelperTest < ActionView::TestCase
-end
diff --git a/guides/code/getting_started/test/models/post_test.rb b/guides/code/getting_started/test/models/article_test.rb
index 6d9d463a71..11c8abe5f4 100644
--- a/guides/code/getting_started/test/models/post_test.rb
+++ b/guides/code/getting_started/test/models/article_test.rb
@@ -1,6 +1,6 @@
require 'test_helper'
-class PostTest < ActiveSupport::TestCase
+class ArticleTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
diff --git a/guides/code/getting_started/test/test_helper.rb b/guides/code/getting_started/test/test_helper.rb
index f91a4375dc..ecbaf77ea7 100644
--- a/guides/code/getting_started/test/test_helper.rb
+++ b/guides/code/getting_started/test/test_helper.rb
@@ -6,9 +6,6 @@ class ActiveSupport::TestCase
ActiveRecord::Migration.check_pending!
# Setup all fixtures in test/fixtures/*.yml 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...