Sha256: 3abd8f2496faad854eeb8c359f7ad6772f755e39736a588421332958fc55620b
Contents?: true
Size: 823 Bytes
Versions: 3
Compression:
Stored size: 823 Bytes
Contents
require_dependency "fuel/application_controller" module Fuel class PostsController < ApplicationController include ActionView::Helpers::TextHelper layout Fuel.configuration.layout if Fuel.configuration.layout before_filter :define_title def define_title @blog_title = Fuel.configuration.blog_title end def index @posts = Fuel::Post.where(published: true).order("created_at DESC").page(params[:page]) end def show # delete || Fuel::Post.find_by_id(params[:id]) once done testing pagination @post = Fuel::Post.find_by_slug(params[:id]) || Fuel::Post.find_by_id(params[:id]) @title = truncate_on_space(@post.title, 70) end private def truncate_on_space(text, length) truncate(text, length: length, separator: ' ') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fuel-0.2.3 | app/controllers/fuel/posts_controller.rb |
fuel-0.2.2 | app/controllers/fuel/posts_controller.rb |
fuel-0.2.1 | app/controllers/fuel/posts_controller.rb |