aboutsummaryrefslogtreecommitdiffstats
path: root/guides/code/getting_started/app/views/posts
diff options
context:
space:
mode:
authorOscar Del Ben <info@oscardelben.com>2012-04-20 10:43:50 +0200
committerOscar Del Ben <info@oscardelben.com>2012-04-20 10:43:50 +0200
commitf6d5036dd620da48624ce32494f63aa4221b05d5 (patch)
treeb023a6730c5dffee1a5724d7c026bfa369efeccf /guides/code/getting_started/app/views/posts
parent0d5a7ad84ddbcb4de7c327e39a7747e00b0cd89f (diff)
downloadrails-f6d5036dd620da48624ce32494f63aa4221b05d5.tar.gz
rails-f6d5036dd620da48624ce32494f63aa4221b05d5.tar.bz2
rails-f6d5036dd620da48624ce32494f63aa4221b05d5.zip
Adapt "Getting started guide" code sample
Diffstat (limited to 'guides/code/getting_started/app/views/posts')
-rw-r--r--guides/code/getting_started/app/views/posts/_form.html.erb45
-rw-r--r--guides/code/getting_started/app/views/posts/new.html.erb2
2 files changed, 15 insertions, 32 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 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? %>
- <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 %>
-
- <div class="field">
- <%= post_form.label :name %><br />
- <%= post_form.text_field :name %>
- </div>
- <div class="field">
- <%= post_form.label :title %><br />
- <%= post_form.text_field :title %>
- </div>
- <div class="field">
- <%= post_form.label :content %><br />
- <%= post_form.text_area :content %>
- </div>
- <h2>Tags</h2>
- <%= render :partial => 'tags/form',
- :locals => {:form => post_form} %>
- <div class="actions">
- <%= post_form.submit %>
- </div>
+<%= form_for :post, :url => { :action => :create } do |f| %>
+ <p>
+ <%= f.label :title %><br>
+ <%= f.text_field :title %>
+ </p>
+
+ <p>
+ <%= f.label :text %><br>
+ <%= f.text_area :text %>
+ </p>
+
+ <p>
+ <%= f.submit %>
+ </p>
<% 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 %>