Shards and loading same-named Rails views

Hi all,

I just ran into an issue with Shards, and wanted to know if what I
experienced is normal or a bug. I’m using Radiant 0.6.6 gem and Shards
from the 0.6.6 SVN tag.

I have two extensions that use Shards, both of which have a similarly
named file:
vendor/extensions/AAA/app/views/admin/page/_css_overrides.rhtml
vendor/extensions/BBB/app/views/admin/page/_css_overrides.html.erb

I load them during each extension’s activate process:
AAA_extension.rb > admin.page.index.add :main, ‘css_overrides’
BBB_extension.rb > admin.page.edit.add :main, ‘css_overrides’

This resulted in only BBB’s css_overrides file getting loaded, both
correctly in admin.page.edit and incorrectly in admin.page.index. AAA’s
css_overrides file was never loaded.

It appears that Shards only chooses the last-loaded extension’s view
template when templates share the same name (but perhaps this is only
happening when adding elements to the :main section?). The workaround
for this is to name the css_overrides files differently.

Is this a known issue?

  • Dave

This is a known issue, and has more to do with Rails than Shards. It
will not be resolved, but should be documented because the workaround is
simple. I would suggest naming the partials something that refers back
to your extension, like _aaa_css_overrides.rhtml for example.

Sean

Sean C. wrote:

This is a known issue, and has more to do with Rails than Shards. It
will not be resolved, but should be documented because the workaround is
simple. I would suggest naming the partials something that refers back
to your extension, like _aaa_css_overrides.rhtml for example.

Thanks Sean. I assume this issue occurs for any similarly named
model/view/controller, and not just view partials?

  • Dave

Exactly.

Sean

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs