A resource named "image" gives problems

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]

[2] http://forums.pragprog.com/forums/59/topics/2723

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.

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