Sha256: 492ccc61536b1a1d0dc79cb02c59b6ea46094f5446d4960ab61f239681f6d753
Contents?: true
Size: 1.03 KB
Versions: 7
Compression:
Stored size: 1.03 KB
Contents
class PostsController < ApplicationController include WebsiteSettings include NotFound def index page = params[:page] || 1 @search = params[:q] || '' @kaminari_params = @search.empty? ? {} : { q: @search } @posts = Character::Post.published @posts = @posts.search(@search) if not @search.empty? @posts = @posts.page(page).per(10) end def author page = params[:page] || 1 @author = Character::PostAuthor.find(params[:slug]) @posts = @author.posts.published @posts = @posts.page(page).per(10) end def category page = params[:page] || 1 @category = Character::PostCategory.find(params[:slug]) @posts = @category.posts.published @posts = @posts.page(page).per(10) end def show @post = Character::Post.find(params[:slug]) end def rss page = params[:page] || 1 @posts = Character::Post.published.page(page).per(10) respond_to do |format| format.all { render :layout => false, content_type: 'text/xml; charset=utf-8' } end end end
Version data entries
7 entries across 7 versions & 1 rubygems