Sha256: 15066c2ccd2682884bb55c4afdbe09367df24be48a86519b98a7be7c1adc23ea
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
# These methods are automatically added to all controllers and views. module Cell module RailsExtensions module ActionController def cell(name, model=nil, options={}, &block) ::Cell::ViewModel.cell(name, model, options.merge(controller: self), &block) end def concept(name, model=nil, options={}, &block) ::Cell::Concept.cell(name, model, options.merge(controller: self), &block) end end module ActionView # Returns the cell instance for +name+. You may pass arbitrary options to your # cell. # # = cell(:song, :title => "Creeping Out Sara").render(:show) def cell(name, *args, &block) controller.cell(name, *args, &block) end # # See Cells::Rails::ActionController#render_cell. # def render_cell(name, state, *args, &block) # ::Cell::Rails.render_cell(name, state, controller, *args, &block) # end def concept(name, *args, &block) controller.concept(name, *args, &block) end end # Gets included into Cell::ViewModel in a Rails environment. module ViewModel extend ActiveSupport::Concern def call(*) super.html_safe end def perform_caching? ::ActionController::Base.perform_caching end def cache_store # we want to use DI to set a cache store in cell/rails. ::ActionController::Base.cache_store end module ClassMethods def expand_cache_key(key) ::ActiveSupport::Cache.expand_cache_key(key, :cells) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cells-4.0.0.beta5 | lib/cell/rails.rb |