
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
Trailblazer's file layout for Cells.
In Trailblazer, class structures as the following are very common, let's say for a post concept, here are the class headers, and where the view directory gets resolved to.
module Post
module Cell
class New < Trailblazer::Cell # => app/concepts/post/view
class Show < Trailblazer::Cell # => app/concepts/post/view
class SideBar < Trailblazer::Cell # => app/concepts/post/view
showYou don't have to define a show method, Trailblazer::Cell will have one that looks as follows.
class Trailblazer::Cell
def show
render
end
When calling render, the view name is inferred from the class name.
module Post
module Cell
class New < Trailblazer::Cell # => new.erb
class Show < Trailblazer::Cell # => show.erb
class SideBar < Trailblazer::Cell # => side_bar.erb
You can still override using render view: :name.
You can pass a layout cell into every Trailblazer::Cell which will render the layout.
Post::Cell::Show.new(post, layout: Gemgem::Cell::Layout).()
The :layout option has to refer to a cell class. When invoked, the layout cell will receive the content of the actual cell under :content, resulting in a call as follows.
Gemgem::Cell::Layout.new(post,
content: Post::Cell::Show.new(post)
)
The layout cell's show view can sit in any directory, for example gemgem/view/layout.rb.
<html>
Yay, I'm the layout!
<%= content %>
</html>
It's up to you what you do with the :content option. Here's the Trailblazer way.
class Gemgem::Cell::Layout < Trailblazer::Cell
self.view_paths = ["gemgem"]
def content
@options[:content]
end
end
Cells with layout cells allow replacing a frameworks entire view stack, e.g. ActionView.
It works identical with namespaces.
Some projects do not use the app/concept view path. This can be changed as follows.
Trailblazer::Cell.view_paths = ["concepts"]
Note that this will change for all cells, including bundled in gems. Introduce an Application::Cell if you don't like that.
This gem has only one dependency: cells. Note that it does not need trailblazer.
FAQs
Unknown package
We found that trailblazer-cells demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.