Commit 1440af8c authored by Paulo Macasaet's avatar Paulo Macasaet

blog 144999

parent 91bf72d9
No preview for this file type
class PostsController < ApplicationController class PostsController < ApplicationController
before_filter :authenticate_user!, :except => [:show, :index]
before_action :authenticate_user!
def index def index
@posts = Post.all @posts = Post.all
render "posts/index.html.erb" render "posts/index.html.erb"
......
<h1>Admin Blog Posts</h1> <h1>Admin Blog Posts</h1>
Hello <%= current_user.email %>
<%= link_to("New Post", new_admin_post_path) %> <%= link_to("New Post", new_admin_post_path) %>
<table width="100%"> <table width="100%">
......
<h1>Blog Posts</h1> <h1>Blog Posts</h1>
Hello <%= current_user.email %>
<table width="100%"> <table width="100%">
<tr> <tr>
<th>Title</th> <th>Title</th>
......
<h1><%= @post.title %></h1> <h1><%= @post.title %></h1>
<h3><%= @post.published_at %> by <%= current_user.email %></h3> <h3><%= @post.published_at %> </h3>
<p> <p>
<%= @post.content %> <%= @post.content %>
</p> </p>
......
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