# A resource named "image" gives problems

**URL:** <https://www.ruby-forum.com/t/a-resource-named-image-gives-problems/174545>\
**Category:** Rails\
**Created:** [August 28, 2009, 1:33pm UTC](https://www.ruby-forum.com/t/a-resource-named-image-gives-problems/174545 "2009-08-28T13:33:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jarl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6bbea6/32.png) [@jarl](https://www.ruby-forum.com/u/jarl)\
**Post date:** [August 28, 2009, 1:33pm UTC](https://www.ruby-forum.com/t/a-resource-named-image-gives-problems/174545/1 "2009-08-28T13:33:34Z")

</div>

Hi.

I can’t be the only one in the world having the wonderful idea to have  
a resource named “image”.

I have a controller named images\_controller  
I have a route named “image”, and therefore a helper called  
image\_path(id).

But using image\_path in an action view erb file gives problems, there  
another helper named image\_path[1] is defined, hence I can no longer  
use the named route url helper image\_path

For now I have changed my routes.rb from  
map.resources :images  
to  
map.resources :images, :singular =\> “my\_image”,

Then I can use my\_image\_path in action views.

But… Isn’t image such a common word for a resource that [1] should  
have a different name, e.g. asset\_path, image\_asset\_path, or something  
else. There is already an alias path\_to\_image[1]. How about just stick  
to  
that?

What do you say?

There are some others having this problem: [2]

Jarl

Footnotes:  
[1]

> **[ActionView::Helpers::AssetTagHelper](https://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html#M001720)**
>
> This module provides methods for generating HTML that links views to assets such as images, JavaScripts, stylesheets, and feeds.

[2] [Pragmatic Bookshelf: By Developers, For Developers](http://forums.pragprog.com/forums/59/topics/2723)

---

<div class="post-metadata">

**Author:** ![jarl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6bbea6/32.png) [@jarl](https://www.ruby-forum.com/u/jarl)\
**Post date:** [August 28, 2009, 3:33pm UTC](https://www.ruby-forum.com/t/a-resource-named-image-gives-problems/174545/2 "2009-08-28T15:33:10Z")

</div>

map.resources :images, :as =\> ‘your\_custom\_name’

You’ve already read the API about the ActionView helpers so you know  
it’s not something you can use.

You can post suggestions in Dev but the likelihood of this being changed  
is nil.
