Sha256: e45d18f26674816ab9fd50a879ce697292e11c44b02b33ca1e45899512a49279

Contents?: true

Size: 643 Bytes

Versions: 3

Compression:

Stored size: 643 Bytes

Contents

class Comfy::Blog::BaseController < Comfy::Cms::BaseController
  
  layout :set_blog_layout

  before_action :load_blog

protected
  
  def load_cms_site
    super
    if @cms_site.path.blank? && params[:cms_path].present?
      raise ActionController::RoutingError.new('Site Not Found')
    end
  end
  
  def load_blog
    @blog = if @cms_site.blogs.count <= 1
      @cms_site.blogs.first!
    else
      @cms_site.blogs.where(:path => params[:blog_path]).first!
    end
    
  rescue ActiveRecord::RecordNotFound
    raise ActionController::RoutingError.new('Blog Not Found')
  end
  
  def set_blog_layout
    @blog.app_layout
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
comfy_blog-1.12.2 app/controllers/comfy/blog/base_controller.rb
comfy_blog-1.12.1 app/controllers/comfy/blog/base_controller.rb
comfy_blog-1.12.0 app/controllers/comfy/blog/base_controller.rb