# Shards and loading same-named Rails views

**URL:** <https://www.ruby-forum.com/t/shards-and-loading-same-named-rails-views/143775>\
**Category:** Radiant CMS\
**Created:** [July 22, 2008, 5:28pm UTC](https://www.ruby-forum.com/t/shards-and-loading-same-named-rails-views/143775 "2008-07-22T17:28:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [July 22, 2008, 5:28pm UTC](https://www.ruby-forum.com/t/shards-and-loading-same-named-rails-views/143775/1 "2008-07-22T17:28:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [July 22, 2008, 6:29pm UTC](https://www.ruby-forum.com/t/shards-and-loading-same-named-rails-views/143775/2 "2008-07-22T18:29:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [July 22, 2008, 6:42pm UTC](https://www.ruby-forum.com/t/shards-and-loading-same-named-rails-views/143775/3 "2008-07-22T18:42:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dpitman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/a9adbd/32.png) [@dpitman](https://www.ruby-forum.com/u/dpitman)\
**Post date:** [July 22, 2008, 7:00pm UTC](https://www.ruby-forum.com/t/shards-and-loading-same-named-rails-views/143775/4 "2008-07-22T19:00:05Z")

</div>

Exactly.

Sean
