module KnowledgeBase::Concerns::Controllers::ArticlesController
Public Instance Methods
index()
click to toggle source
# File lib/knowledge_base/concerns/controllers/articles_controller.rb, line 8 def index if @category scope = @category.articles else scope = Article.all end scope = scope.published @search = scope.search params[:q] @articles = @search.result.includes(:sections) end
set_category()
click to toggle source
# File lib/knowledge_base/concerns/controllers/articles_controller.rb, line 33 def set_category @category = Category.friendly.find params[:category_id] if params.has_key? :category_id end
show()
click to toggle source
# File lib/knowledge_base/concerns/controllers/articles_controller.rb, line 21 def show if @category scope = @category.articles else scope = Article.all end @article = scope.published.friendly.find params[:id] end