diff options
Diffstat (limited to 'guides/code/getting_started/app/views/posts')
3 files changed, 13 insertions, 5 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 46ec257b91..f22139938c 100644 --- a/guides/code/getting_started/app/views/posts/_form.html.erb +++ b/guides/code/getting_started/app/views/posts/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for :post, :url => { :action => :update, :id => @post.id }, :method => :put do |f| %> +<%= 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> @@ -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/index.html.erb b/guides/code/getting_started/app/views/posts/index.html.erb index 3ba7091c15..7b72720d50 100644 --- a/guides/code/getting_started/app/views/posts/index.html.erb +++ b/guides/code/getting_started/app/views/posts/index.html.erb @@ -8,6 +8,7 @@ <th>Text</th> <th></th> <th></th> + <th></th> </tr> <% @posts.each do |post| %> @@ -16,6 +17,7 @@ <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, :confirm => 'Are you sure?' %> </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 index aea28cd5a2..65809033ed 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,11 @@ <%= @post.text %> </p> -<%= link_to 'Back', :action => :index %> -| <%= link_to 'Edit', :action => :edit, :id => @post.id %> +<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 %> |