Class: PostsController

Inherits:
Eksa::Controller show all
Defined in:
app/controllers/posts_controller.rb

Instance Attribute Summary

Attributes inherited from Eksa::Controller

#flash, #redirect_url, #request, #status

Instance Method Summary collapse

Methods inherited from Eksa::Controller

#asset_path, #current_user, #initialize, #javascript_tag, #params, #redirect_to, #render, #render_internal, #require_auth, #session, #stylesheet_tag

Constructor Details

This class inherits a constructor from Eksa::Controller

Instance Method Details

#indexObject



2
3
4
5
# File 'app/controllers/posts_controller.rb', line 2

def index
  @posts = Eksa::MarkdownPost.all
  render "posts/index"
end

#showObject



7
8
9
10
11
12
13
14
# File 'app/controllers/posts_controller.rb', line 7

def show
  @post = Eksa::MarkdownPost.find(params['slug'])
  if @post
    render "posts/show"
  else
    [404, { 'content-type' => 'text/html' }, ["Post not found"]]
  end
end