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

Added Posts edit page

parent 722e6980
...@@ -33,6 +33,7 @@ class PostsController < ApplicationController ...@@ -33,6 +33,7 @@ class PostsController < ApplicationController
end end
def edit def edit
@post = Post.find_by(id: params[:id])
end end
private private
......
<h1>Posts#edit</h1> <h1>Edit Post</h1>
<p>Find me in app/views/posts/edit.html.erb</p>
<%= 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 @@ ...@@ -32,6 +32,9 @@
<td> <td>
<%= link_to "Delete", post_path(post), class: "btn btn-danger", method: :delete, data: { confirm: "Are you sure you want to delete?" } %> <%= link_to "Delete", post_path(post), class: "btn btn-danger", method: :delete, data: { confirm: "Are you sure you want to delete?" } %>
</td> </td>
<td>
<%= link_to "Edit", edit_post_path(post), class: "btn btn-primary" %>
</td>
</tr> </tr>
<% end %> <% end %>
</tbody> </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