Cells v4.0.0 Release Notes
-
- ๐ Rails Support: Rails 4.0+ is fully supported, in older versions some form helpers do not work. Let us know how you fixed this.
- State args: View models don't use state args. Options are passed into the constructor and saved there. That means that caching callbacks no longer receive arguments as everything is available via the instance itself.
- ๐ง
ViewModel.new(song: song)
won't automatically create a reader#song
. You have to configure the cell to use a Struct twin {TODO: document} - HTML Escaping: Escaping only happens for defined
property
s whenEscaped
is included. - Template Engines: There's now one template engine (e.g. ERB or HAML) per cell class. It can be set by including the respective module (e.g.
Cell::Erb
) into the cell class. This happens automatically in Rails. - File Naming. The default filename just uses the engine suffix, e.g.
show.haml
. If you have two different engine formats (e.g.show.haml
andshow.erb
), use theformat:
option:render format: :erb
. If you need to render a specific mime type, provide the filename:render view: "show.html"
. - ๐ Builder blocks are no longer executed in controller context but in the context they were defined. This is to remove any dependencies to the controller. If you need e.g.
params
, pass them into the#cell(..)
call. - ๐ Builders are now defined using
::builds
, not::build
.
โ Removed
- ๐
Cell::Rails
andCell::Base
got removed. Every cell isViewModel
orConcept
now. - All methods from
AbstractController
are gone. This might give you trouble in case you were usinghelper_method
. You don't need this anymore - every method included in the cell class is a "helper" in the view (it's one and the same method call).