diff options
| author | Oscar Del Ben <info@oscardelben.com> | 2012-04-30 09:08:32 +0200 | 
|---|---|---|
| committer | Oscar Del Ben <info@oscardelben.com> | 2012-04-30 09:08:32 +0200 | 
| commit | 06a1519a4dc714822bec2312a41950aedba82541 (patch) | |
| tree | 153fe974b32932e3a0c5efbaa062007cfcd11130 /guides/code/getting_started/app/views/posts | |
| parent | bb6bd01d41d7715d398d69f1a8fe462f33d6087a (diff) | |
| download | rails-06a1519a4dc714822bec2312a41950aedba82541.tar.gz rails-06a1519a4dc714822bec2312a41950aedba82541.tar.bz2 rails-06a1519a4dc714822bec2312a41950aedba82541.zip  | |
Rewrite adding a second model section of Getting Started Guide
Diffstat (limited to 'guides/code/getting_started/app/views/posts')
| -rw-r--r-- | guides/code/getting_started/app/views/posts/_form.html.erb | 4 | ||||
| -rw-r--r-- | guides/code/getting_started/app/views/posts/show.html.erb | 20 | 
2 files changed, 20 insertions, 4 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 b35ea2f237..f22139938c 100644 --- a/guides/code/getting_started/app/views/posts/_form.html.erb +++ b/guides/code/getting_started/app/views/posts/_form.html.erb @@ -10,12 +10,12 @@      </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> 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 aea28cd5a2..0580879c1a 100644 --- a/guides/code/getting_started/app/views/posts/show.html.erb +++ b/guides/code/getting_started/app/views/posts/show.html.erb @@ -8,5 +8,21 @@    <%= @post.text %>  </p> -<%= link_to 'Back', :action => :index %> -| <%= link_to 'Edit', :action => :edit, :id => @post.id %> + +<h2>Add a comment:</h2> +<%= form_for([@post, @post.comments.build]) do |f| %> +  <p> +    <%= f.label :commenter %><br /> +    <%= f.text_field :commenter %> +  </p> +  <p> +    <%= f.label :body %><br /> +    <%= f.text_area :body %> +  </p> +  <p> +    <%= f.submit %> +  </p> +<% end %> + +<%= link_to 'Edit Post', edit_post_path(@post) %> | +<%= link_to 'Back to Posts', posts_path %>  | 
