Sha256: 7d4c15a52bc9f0df5aae1f485d306b80f11a2041a1d633b39bd232c55c262dec

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

require 'abstract_controller'
require 'cell/builder'
require 'cell/caching'
require 'cell/rendering'
require 'cell/rails3_0_strategy' if Cells.rails3_0?
require 'cell/rails3_1_strategy' if Cells.rails3_1_or_more?

module Cell
  class Base < AbstractController::Base
    abstract!
    DEFAULT_VIEW_PATHS = [File.join('app', 'cells')]
    
    extend Builder
    include AbstractController
    include AbstractController::Rendering, Layouts, Helpers, Callbacks, Translation, Logger
    
    include VersionStrategy
    include Rendering
    include Caching
    
    class View < ActionView::Base
      def render(*args, &block)
        options = args.first.is_a?(::Hash) ? args.first : {}  # this is copied from #render by intention.
        
        return controller.render(*args, &block) if options[:state] or options[:view]
        super
      end
    end
    
    
    # Called in Railtie at initialization time.
    def self.setup_view_paths!
      self.view_paths = self::DEFAULT_VIEW_PATHS
    end
    
    def self.controller_path
      @controller_path ||= name.sub(/Cell$/, '').underscore unless anonymous?
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cells-3.8.5 lib/cell/base.rb
cells-3.8.3 lib/cell/base.rb
cells-3.8.2 lib/cell/base.rb
cells-3.8.1 lib/cell/base.rb