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 --- .../getting_started/app/views/posts/_form.html.erb | 45 +++++++--------------- .../getting_started/app/views/posts/new.html.erb | 2 +- 2 files changed, 15 insertions(+), 32 deletions(-) (limited to 'guides/code/getting_started/app/views/posts') 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:

- -
- <% 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 %> -- cgit v1.2.3