bronson / error_page_assets

Let the asset pipeline generate your static error pages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use layout?

TroySK opened this issue · comments

With Rails 5. This might describe the technique: https://evilmartians.com/chronicles/new-feature-in-rails-5-render-views-outside-of-actions . I should include an example. Leaving this issue open to remind myself.

Also, I've been meaning to clean this gem up. It works OK now, but it could be a more general & useful. I'm not maintaining any Rails apps right now so it's kinda hard to find the time. Bug me in a few weeks if I forget. (which I probably will...)

I use layouts to handle complex partials, like a header with multiple states, and I just worked around this issue by booting my own Rails view instance inside the template:

<% renderer = ActionView::Base.new(ActionController::Base.view_paths, {}) %>
<%= renderer.render(file: '/_header.html.erb', locals: {className: 'fixed'}) %>

Works like a charm.