Class: Cell::Rails

Inherits:
Rack
  • Object
show all
Includes:
ActionController::RequestForgeryProtection, ActionView::Helpers::UrlHelper, DSL, LinkToHelper
Defined in:
lib/cell/rails/view_model.rb,
lib/cell/rails.rb,
lib/cell/rails/helper_api.rb

Overview

Allows using many Rails gem in your cells outside of a Rails environment.

Defined Under Namespace

Modules: DSL, HelperAPI, LinkToHelper, ViewModel

Constant Summary

Constant Summary

Constants inherited from Base

Base::DEFAULT_VIEW_PATHS

Instance Attribute Summary (collapse)

Attributes inherited from Rack

#request

Attributes included from Caching

#cache_configured

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from LinkToHelper

#convert_options_to_data_attributes, #link_to, #link_to_remote_options?

Methods included from DSL

#cell

Methods inherited from Rack

render_cell_state

Methods included from Builder

#build, #build_for, #class_from_cell_name, #create_cell, #create_cell_for

Methods included from DSL

#cell

Methods included from Caching

#cache?, #render_state

Methods included from Rendering

#render, #render_state

Constructor Details

- (Rails) initialize(parent_controller, *args)



34
35
36
37
# File 'lib/cell/rails.rb', line 34

def initialize(parent_controller, *args)
  super(parent_controller, *args) # FIXME: huh?
  @parent_controller = parent_controller
end

Instance Attribute Details

- (Object) parent_controller (readonly) Also known as: controller

Returns the value of attribute parent_controller



31
32
33
# File 'lib/cell/rails.rb', line 31

def parent_controller
  @parent_controller
end

Class Method Details

+ (Object) cache_store



12
13
14
15
16
17
# File 'lib/cell/rails.rb', line 12

def cache_store
  # FIXME: i'd love to have an initializer in the cells gem that _sets_ the cache_store attr instead of overriding here.
  # since i dunno how to do that we'll have this method in rails for now.
  # DISCUSS: should this be in Cell::Rails::Caching ?
  ActionController::Base.cache_store
end

+ (Object) expire_cache_key(key, *args)

FIXME: move to Rails.



19
20
21
# File 'lib/cell/rails.rb', line 19

def expire_cache_key(key, *args)  # FIXME: move to Rails.
  expire_cache_key_for(key, cache_store ,*args)
end

Instance Method Details

- (Boolean) cache_configured?



39
40
41
# File 'lib/cell/rails.rb', line 39

def cache_configured?
  ActionController::Base.send(:cache_configured?) # DISCUSS: why is it private?
end

- (Object) cache_store



43
44
45
# File 'lib/cell/rails.rb', line 43

def cache_store
  self.class.cache_store  # in Rails, we have a global cache store.
end