aboutsummaryrefslogtreecommitdiffstats
path: root/guides/code/getting_started/app/views/posts
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2013-01-22 00:12:29 -0500
committerSteve Klabnik <steve@steveklabnik.com>2013-01-22 00:12:29 -0500
commit2214237c3950445208635a332d520d6aa530c1de (patch)
tree13037ba04286f9d03d5fab5606aadd436b9719e8 /guides/code/getting_started/app/views/posts
parent51b9def5bf108fb566e0d2293f49abb5aeb0add7 (diff)
downloadrails-2214237c3950445208635a332d520d6aa530c1de.tar.gz
rails-2214237c3950445208635a332d520d6aa530c1de.tar.bz2
rails-2214237c3950445208635a332d520d6aa530c1de.zip
Re-do Getting Started application with Rails 4.
The sample application with the Getting Started Guide was very out of date. I've re-done it on edge (as of 51b9def5bf108fb566e) so it should be good to go with Rails 4. It's also in synch with what the guide actually says.
Diffstat (limited to 'guides/code/getting_started/app/views/posts')
-rw-r--r--guides/code/getting_started/app/views/posts/_form.html.erb26
-rw-r--r--guides/code/getting_started/app/views/posts/edit.html.erb8
-rw-r--r--guides/code/getting_started/app/views/posts/index.html.erb14
-rw-r--r--guides/code/getting_started/app/views/posts/new.html.erb6
-rw-r--r--guides/code/getting_started/app/views/posts/show.html.erb6
5 files changed, 30 insertions, 30 deletions
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 f22139938c..c9fb74af9c 100644
--- a/guides/code/getting_started/app/views/posts/_form.html.erb
+++ b/guides/code/getting_started/app/views/posts/_form.html.erb
@@ -1,25 +1,27 @@
<%= form_for @post do |f| %>
<% if @post.errors.any? %>
- <div id="errorExplanation">
- <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
- <ul>
- <% @post.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
- </div>
+ <div id="errorExplanation">
+ <h2><%= pluralize(@post.errors.count, "error") %> prohibited
+ this post from being saved:</h2>
+ <ul>
+ <% @post.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
<% end %>
<p>
- <%= f.label :title %><br />
+ <%= f.label :title %><br>
<%= f.text_field :title %>
</p>
-
+
<p>
- <%= f.label :text %><br />
+ <%= f.label :text %><br>
<%= f.text_area :text %>
</p>
-
+
<p>
<%= f.submit %>
</p>
<% end %>
+
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 911a48569d..393e7430d0 100644
--- a/guides/code/getting_started/app/views/posts/edit.html.erb
+++ b/guides/code/getting_started/app/views/posts/edit.html.erb
@@ -1,5 +1,5 @@
-<h1>Editing post</h1>
-
+<h1>Edit post</h1>
+
<%= render 'form' %>
-
-<%= link_to 'Back', :action => :index %>
+
+<%= 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 9a0e90eadc..7369f0396f 100644
--- a/guides/code/getting_started/app/views/posts/index.html.erb
+++ b/guides/code/getting_started/app/views/posts/index.html.erb
@@ -1,7 +1,4 @@
-<h1>Listing posts</h1>
-
-<%= link_to 'New post', :action => :new %>
-
+<h1>Listing Posts</h1>
<table>
<tr>
<th>Title</th>
@@ -10,14 +7,15 @@
<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><%= link_to 'Edit', :action => :edit, :id => post.id %>
- <td><%= link_to 'Destroy', { :action => :destroy, :id => post.id }, :method => :delete, :data => { :confirm => 'Are you sure?' } %>
+ <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/new.html.erb b/guides/code/getting_started/app/views/posts/new.html.erb
index ce9523a721..efa81038ec 100644
--- a/guides/code/getting_started/app/views/posts/new.html.erb
+++ b/guides/code/getting_started/app/views/posts/new.html.erb
@@ -1,5 +1,5 @@
<h1>New post</h1>
-
+
<%= render 'form' %>
-
-<%= link_to 'Back', :action => :index %>
+
+<%= 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 65809033ed..e99e9edbb3 100644
--- a/guides/code/getting_started/app/views/posts/show.html.erb
+++ b/guides/code/getting_started/app/views/posts/show.html.erb
@@ -2,7 +2,7 @@
<strong>Title:</strong>
<%= @post.title %>
</p>
-
+
<p>
<strong>Text:</strong>
<%= @post.text %>
@@ -10,9 +10,9 @@
<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 %>