Class: SofaBlog::PostsController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



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

def index
  @posts = SofaBlog::Post.published.all
rescue ActiveRecord::RecordNotFound
  render :text => 'Post not found', :status => 404
end

#showObject



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

def show
  @post = SofaBlog::Post.find(params[:id])
rescue ActiveRecord::RecordNotFound
  render :text => 'Post not found', :status => 404
end