Class: BlogsController

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

Instance Method Summary collapse

Instance Method Details

#archiveObject



5
6
7
# File 'app/controllers/blogs_controller.rb', line 5

def archive
  @posts_by_month = @blog.posts_by_month
end

#feedObject



9
10
11
# File 'app/controllers/blogs_controller.rb', line 9

def feed
  @posts = @blog.posts.published
end

#searchObject



13
14
15
# File 'app/controllers/blogs_controller.rb', line 13

def search
  @posts = params[:keyword] ? @blog.search(params[:keyword]) : []
end

#showObject



17
18
19
# File 'app/controllers/blogs_controller.rb', line 17

def show
  @posts = @blog.posts.page(params[:page]).published.per(@blog.posts_per_page)
end