Sha256: 21efb2c9d7378f3fa4b57fab64505649efeb4e7e64c8587db298c39545b405b3

Contents?: true

Size: 629 Bytes

Versions: 3

Compression:

Stored size: 629 Bytes

Contents

class Blog::BaseController < 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.1.1 app/controllers/blog/base_controller.rb
comfy_blog-1.1.0 app/controllers/blog/base_controller.rb
comfy_blog-1.0.0 app/controllers/blog/base_controller.rb