Commit 041d3258 authored by John Noel's avatar John Noel

Added Post show page and function

parent 3ebbf0aa
...@@ -4,6 +4,7 @@ class PostsController < ApplicationController ...@@ -4,6 +4,7 @@ class PostsController < ApplicationController
end end
def show def show
@post = Post.find_by(id: params[:id])
end end
def new def new
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
<td> <td>
<%= post.content %> <%= post.content %>
</td> </td>
<td>
<%= link_to "Show", post_path(post), class: "btn btn-primary" %>
</td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
......
<h1>Posts#show</h1> <h1>Post #<%= @post.id %></h1>
<p>Find me in app/views/posts/show.html.erb</p> <h2>
<%= @post.title %>
</h2>
<p>
<%= @post.content %>
</p>
<%= link_to "Back", posts_path, class: "btn btn-default" %>
\ No newline at end of file
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