Class: Cell::Rack
- Defined in:
- lib/cell/rack.rb
Overview
Use Cell::Rack to mount your cell to a rack-route with a working session and params reference in the cell. This is especially useful when using gems like devise with your cell, without the entire Cell::Rails overhead.
The only dependency these kinds of cells have is a Rack-compatible request object.
Example:
match "/dashboard/comments" => proc { |env|
request = ActionDispatch::Request.new(env)
[ 200, {}, [ Cell::Rack.render_cell_for(:comments, :show, request) ]]
}
Direct Known Subclasses
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Attributes included from Caching
#cache_configured, #cache_store
Class Method Summary collapse
-
.render_cell_state(cell, state, request, *args) ⇒ Object
DISCUSS: i don’t like these class methods.
Instance Method Summary collapse
-
#initialize(request, *args) ⇒ Rack
constructor
A new instance of Rack.
Methods inherited from Base
cell_for, class_from_cell_name
Methods included from Builder::ClassMethods
Methods included from Base::SelfContained
Methods included from Base::Prefixes
Methods included from DSL
Methods included from Caching
#cache?, #cache_configured?, #render_state
Methods included from Rendering
Constructor Details
#initialize(request, *args) ⇒ Rack
Returns a new instance of Rack.
27 28 29 30 |
# File 'lib/cell/rack.rb', line 27 def initialize(request, *args) super(*args) @request = request end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
17 18 19 |
# File 'lib/cell/rack.rb', line 17 def request @request end |
Class Method Details
.render_cell_state(cell, state, request, *args) ⇒ Object
DISCUSS: i don’t like these class methods. maybe a RenderingStrategy?
22 23 24 |
# File 'lib/cell/rack.rb', line 22 def render_cell_state(cell, state, request, *args) # defined in Rendering. super(cell, state, *args) end |