Commit 3251579f authored by John Noel's avatar John Noel

Added Posts edit page

parent 722e6980
......@@ -33,6 +33,7 @@ class PostsController < ApplicationController
end
def edit
@post = Post.find_by(id: params[:id])
end
private
......
<h1>Posts#edit</h1>
<p>Find me in app/views/posts/edit.html.erb</p>
<h1>Edit Post</h1>
<%= simple_form_for @post do |f| %>
<%= f.input :title %>
<%= f.input :content %>
<%= f.button :submit, "Post", class: "btn btn-primary" %>
<%= link_to "Back", posts_path, class: "btn btn-default" %>
<% end %>
\ No newline at end of file
......@@ -32,6 +32,9 @@
<td>
<%= link_to "Delete", post_path(post), class: "btn btn-danger", method: :delete, data: { confirm: "Are you sure you want to delete?" } %>
</td>
<td>
<%= link_to "Edit", edit_post_path(post), class: "btn btn-primary" %>
</td>
</tr>
<% end %>
</tbody>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment