I'm working on an rails app with several mountable engines. I use the deface gem to override some part of views but I'm having some issues to update some of them.
I don't know if it's a problem or a mistake that I'm making but it seems like deface
has some problems to trigger when you have a partial inside the layout
file (I'm also working with mountable engines)
Let me explain with an example. I have the following code on my app on application.html.erb file.
<!-- some code -->
<div class = "container">
<header class="masthead">
<%= render "shared/navbar" %>
</header>
<!-- some more code -->
And on the navbar.html.erb file I have:
<!-- some code -->
<li data-dat-hook='main_nav' class="nav-item">
<%= link_to 'Home', dat.root_path, class: "nav-link" %>
</li>
<!-- some more code -->
What will trigger deface is the data-dat-hook
.
Defined in the proper file, in the proper place:
Deface::Override.new(:virtual_path => "dat/shared/_navbar",
:name => "add_contacts_link_to_main_nav",
:insert_after => "[data-dat-hook='main_nav']",
:partial => "overrides/analyses_link",
:namespaced => true)
Deface seems to not even realize the existence of this virtual path. I don't know why... If I move the code from the partial to the layout file (and update the virtual path) things work perfectly.