Class: Spooky::PostsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/spooky/posts_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/spooky/posts_controller.rb', line 3

def index
  @posts, @pagination = ghost.posts(
    include: "authors,tags",
    filter: "visibility:public",
    page: params[:page].presence,
    limit: params[:limit].presence
  )

  render_404 unless @posts

  respond_to do |format|
    format.html
    format.atom
  end
end

#showObject



19
20
21
22
# File 'app/controllers/spooky/posts_controller.rb', line 19

def show
  @post = ghost.post_by(slug: params[:id])
  render_404 unless @post
end