Class: BlogsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#render_404

Instance Method Details

#archiveObject



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

def archive
  @posts_by_month = @blog.posts_by_month
end

#feedObject



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

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

#searchObject



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

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

#showObject



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

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