Class: Cell::Rails
- Includes:
- ActionController::RequestForgeryProtection, ActionView::Helpers::UrlHelper, DSL, LinkToHelper
- Defined in:
- lib/cell/rails/helper_api.rb,
lib/cell/rails.rb,
lib/cell/rails/view_model.rb
Overview
TODO: warn when using ::property but not passing in model in constructor.
Direct Known Subclasses
Defined Under Namespace
Modules: DSL, HelperAPI, LinkToHelper, ViewModel Classes: Builder
Instance Attribute Summary collapse
-
#parent_controller ⇒ Object
(also: #controller)
readonly
Returns the value of attribute parent_controller.
Attributes inherited from Rack
Attributes included from Caching
Class Method Summary collapse
- .cache_store ⇒ Object
-
.cell_for(name, controller, *args) ⇒ Object
Main entry point for instantiating cells.
-
.expire_cache_key(key, *args) ⇒ Object
FIXME: move to Rails.
Instance Method Summary collapse
- #cache_configured? ⇒ Boolean
- #cache_store ⇒ Object
-
#initialize(parent_controller, *args) ⇒ Rails
constructor
A new instance of Rails.
Methods included from LinkToHelper
#convert_options_to_data_attributes, #link_to, #link_to_remote_options?
Methods included from DSL
Methods inherited from Rack
Methods inherited from Base
Methods included from Builder::ClassMethods
Methods included from Base::SelfContained
Methods included from Base::Prefixes
Methods included from DSL
Methods included from Caching
Methods included from Rendering
Constructor Details
#initialize(parent_controller, *args) ⇒ Rails
Returns a new instance of Rails.
41 42 43 44 |
# File 'lib/cell/rails.rb', line 41 def initialize(parent_controller, *args) super(parent_controller, *args) # FIXME: huh? @parent_controller = parent_controller end |
Instance Attribute Details
#parent_controller ⇒ Object (readonly) Also known as: controller
Returns the value of attribute parent_controller.
38 39 40 |
# File 'lib/cell/rails.rb', line 38 def parent_controller @parent_controller end |
Class Method Details
.cache_store ⇒ Object
18 19 20 21 22 23 |
# File 'lib/cell/rails.rb', line 18 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 |
.cell_for(name, controller, *args) ⇒ Object
Main entry point for instantiating cells.
31 32 33 34 |
# File 'lib/cell/rails.rb', line 31 def cell_for(name, controller, *args) # FIXME: too much redundancy from Base. Builder.new(class_from_cell_name(name), controller).call(controller, *args) # use Cell::Rails::Builder. end |
.expire_cache_key(key, *args) ⇒ Object
FIXME: move to Rails.
25 26 27 |
# File 'lib/cell/rails.rb', line 25 def expire_cache_key(key, *args) # FIXME: move to Rails. expire_cache_key_for(key, cache_store ,*args) end |
Instance Method Details
#cache_configured? ⇒ Boolean
46 47 48 |
# File 'lib/cell/rails.rb', line 46 def cache_configured? ActionController::Base.send(:cache_configured?) # DISCUSS: why is it private? end |
#cache_store ⇒ Object
50 51 52 |
# File 'lib/cell/rails.rb', line 50 def cache_store self.class.cache_store # in Rails, we have a global cache store. end |