Class: Buttercms::PostsController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/generators/templates/app/controllers/buttercms/posts_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



2
3
4
5
6
7
# File 'lib/generators/templates/app/controllers/buttercms/posts_controller.rb', line 2

def index
  @posts = ButterCMS::Post.all(:page => params[:page], :page_size => 10)

  @next_page = @posts.meta.next_page
  @previous_page = @posts.meta.previous_page
end

#showObject



9
10
11
12
13
14
# File 'lib/generators/templates/app/controllers/buttercms/posts_controller.rb', line 9

def show
  @post = ButterCMS::Post.find(params[:slug])

  @next_post = @post.meta.next_post
  @previous_post = @post.meta.previous_post
end