# Locale parameter on URL

**URL:** <https://www.ruby-forum.com/t/locale-parameter-on-url/186564>\
**Category:** Rails I18n\
**Created:** [April 8, 2010, 11:24pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564 "2010-04-08T23:24:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 8, 2010, 11:24pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/1 "2010-04-08T23:24:06Z")

</div>

Hello guys. I just started learning Rails and one of the first things  
I was interested was the localization of my website.  
I started looking the rails-i18n and it worked beautifully, except for  
some things. e.g.: i wanted the url to be /en/books instead of  
the locale=en, so I tried what they say on

> **[Rails Internationalization (I18n) API — Ruby on Rails Guides](https://guides.rubyonrails.org/i18n.html)**
>
> Rails Internationalization (I18n) APIThe Ruby I18n (shorthand for internationalization) gem which is shipped with Ruby on Rails (starting from Rails 2.2) provides an easy-to-use and extensible framework for translating your application to a single...

about the :path\_prefix on routes.rb. But it just didn’t worked…  
Here is my routes.rb:

ActionController::Routing::Routes.draw do |map|  
map.resources :mannequins, :path\_prefix =\> ‘/:locale’  
map.resources :recipes, :path\_prefix =\> ‘/:locale’

# The priority is based upon order of creation: first created →

highest priority.

# Sample of regular route:

# map.connect ‘products/:id’, :controller =\> ‘catalog’, :action =\>

‘view’

# Keep in mind you can assign values other than :controller

and :action

# Sample of named route:

# map.purchase ‘products/:id/purchase’, :controller =\>

‘catalog’, :action =\> ‘purchase’

# This route can be invoked with purchase\_url(:id =\> product.id)

# Sample resource route (maps HTTP verbs to controller actions

automatically):

# map.resources :products

# Sample resource route with options:

# map.resources :products, :member =\> { :short =\> :get, :toggle

=\> :post }, :collection =\> { :sold =\> :get }

# Sample resource route with sub-resources:

# map.resources :products, :has\_many =\>

[:comments, :sales], :has\_one =\> :seller

# Sample resource route with more complex sub-resources

# map.resources :products do |products|

# products.resources :comments

# products.resources :sales, :collection =\> { :recent =\> :get }

# end

# Sample resource route within a namespace:

# map.namespace :admin do |admin|

# # Directs /admin/products/\* to Admin::ProductsController (app/

controllers/admin/products\_controller.rb)

# admin.resources :products

# end

# You can have the root of your site routed with map.root – just

remember to delete public/index.html.  
map.root :controller =\> “recipes”, :path\_prefix =\> ‘/:locale’

# See how all your routes lay out with “rake routes”

# Install the default routes as the lowest priority.

# Note: These default routes make all actions in every controller

accessible via GET requests. You should

# consider removing or commenting them out if you’re using named

routes and resources.  
map.connect ‘:controller/:action/:id’  
map.connect ‘:controller/:action/:id.:format’  
end

but when I try to access [http://localhost:3000/fr/recipes](http://localhost:3000/fr/recipes) I get

ActionController::RoutingError in Recipes#index  
Showing app/views/recipes/index.html.erb where line #15 raised:  
recipe\_url failed to generate from {:locale=\>#\<Recipe id: 2, ti…

Can anyone shed some light on this for me?

‘-’

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 1:29am UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/2 "2010-04-09T01:29:21Z")

</div>

Can you show me line #15 of app/views/recipes/index.html.erb?

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 12:53pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/3 "2010-04-09T12:53:02Z")

</div>

Line #15 contains the following:

\<%= link\_to 'Show', recipe %\>

That’s it…

Att.  
Paulo H. Vieira Neves  
Bsc. Sistemas de InformaÃ§Ã£o  
+55 38 9141 5400  
MSN: removed\_email\_address@domain.invalid  
GTALK: removed\_email\_address@domain.invalid  
SKYPE: paulodemoc

2010/4/8 AndrÃ©s MejÃ­a [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 1:31pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/4 "2010-04-09T13:31:06Z")

</div>

Can you try this:

\<%= link\_to “Show” recipe\_path(@recipe) %\>

In the conntroller show you must pass a variable named @recipe with the  
object

2010/4/9 Paulo H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> +55 38 9141 5400
> 
> > > ActionController::Routing::Routes.draw do |map|  
> > > and :action
> > > 
> > > # Sample resource route with options:
> > > 
> > > # products.resources :sales, :collection =\> { :recent =\> :get }
> > > 
> > > remember to delete public/index.html.  
> > > map.connect ‘:controller/:action/:id.:format’  
> > > ‘-’

–  
Experiencia es lo que obtienes, cuando no obtienes lo que quieres.

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 1:57pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/5 "2010-04-09T13:57:27Z")

</div>

Do yo have this?

# app/controllers/application\_controller.rb

def default\_url\_options(options={})  
logger.debug “default\_url\_options is passed options:  
#{options.inspect}\n”  
{ :locale =\> I18n.locale }  
end

Ah! in the console put this:  
rake routes

To see what is generating

2010/4/9 Paulo H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> =\> :delete %\>  
> GTALK: removed\_email\_address@domain.invalid
> 
> > > > Paulo H. Vieira Neves
> > > > 
> > > > > > Here is my routes.rb:
> > > > > > 
> > > > > > # map.connect ‘products/:id’, :controller =\> ‘catalog’, :action =\>
> > > > > > 
> > > > > > automatically):
> > > > > > 
> > > > > > # Sample resource route with more complex sub-resources
> > > > > > 
> > > > > > # end
> > > > > > 
> > > > > > # consider removing or commenting them out if you’re using named
> > > > > > 
> > > > > > .  
> > > > > > .  
> > > > > > .  
> > > > > > "Caminar sobre el agua y desarrollar software a partir de unas  
> > > > > > "Caminar sobre el agua y desarrollar software a partir de unas  
> > > > > > For more options, visit this group at  
> > > > > > For more options, visit this group at  
> > > > > > [http://groups.google.com/group/rails-i18n?hl=en](http://groups.google.com/group/rails-i18n?hl=en).

–  
Experiencia es lo que obtienes, cuando no obtienes lo que quieres.

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 1:34pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/6 "2010-04-09T13:34:37Z")

</div>

Sorry are you iterating in a variable named @recipes?

In this case, the link must be this:

\<% @recipes.each do |recipe| %\>  
\<%= link\_to “Show” recipe\_path(recipe) %\>  
\<% end %\>  
El 9 de abril de 2010 13:29, AndrÃ©s gutiÃ©rrez  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)escribiÃ³:

> > GTALK: removed\_email\_address@domain.invalid
> > 
> > > > I was interested was the localization of my website.  
> > > > map.resources :recipes, :path\_prefix =\> ‘/:locale’
> > > > 
> > > > # Sample of named route:
> > > > 
> > > > =\> :post }, :collection =\> { :sold =\> :get }
> > > > 
> > > > –  
> > > > –  
> > > > –
> 
> –  
> Experiencia es lo que obtienes, cuando no obtienes lo que quieres.
> 
> * * *
> 
> “Caminar sobre el agua y desarrollar software a partir de unas  
> especificaciones es fÃ¡cil. si ambas estÃ¡n congeladas.”  
> Edward V. Berard, ingeniero informÃ¡tico.

–  
Experiencia es lo que obtienes, cuando no obtienes lo que quieres.

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 1:39pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/7 "2010-04-09T13:39:18Z")

</div>

Yeah, I am iterating… Here’s the code:

\<% @recipes.each do |recipe| %\>

 \<%=h recipe.title %\> \<%=h recipe.author %\> \<%=h recipe.description %\> \<%= link\_to 'Show', recipe\_path(recipe) %\> \<%= link\_to 'Edit', edit\_recipe\_path(recipe) %\> \<%= link\_to 'Destroy', recipe, :confirm =\> 'Are you sure?', :method =\> :delete %\> \<% end %\>

But I got the same error…

Att.  
Paulo H. Vieira Neves  
Bsc. Sistemas de InformaÃ§Ã£o  
+55 38 9141 5400  
MSN: removed\_email\_address@domain.invalid  
GTALK: removed\_email\_address@domain.invalid  
SKYPE: paulodemoc

2010/4/9 AndrÃ©s gutiÃ©rrez [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 2:05pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/8 "2010-04-09T14:05:03Z")

</div>

I have that on application\_controller.rb, and when I ran ‘rake routes’,  
I  
got this:

```
mannequins GET /:locale/mannequins(.:format)

```

{:controller=\>“mannequins”, :action=\>“index”}  
POST /:locale/mannequins(.:format)  
{:controller=\>“mannequins”, :action=\>“create”}  
new\_mannequin GET /:locale/mannequins/new(.:format)  
{:controller=\>“mannequins”, :action=\>“new”}  
edit\_mannequin GET /:locale/mannequins/:id/edit(.:format)  
{:controller=\>“mannequins”, :action=\>“edit”}  
mannequin GET /:locale/mannequins/:id(.:format)  
{:controller=\>“mannequins”, :action=\>“show”}  
PUT /:locale/mannequins/:id(.:format)  
{:controller=\>“mannequins”, :action=\>“update”}  
DELETE /:locale/mannequins/:id(.:format)  
{:controller=\>“mannequins”, :action=\>“destroy”}  
recipes GET /:locale/recipes(.:format)  
{:controller=\>“recipes”, :action=\>“index”}  
POST /:locale/recipes(.:format)  
{:controller=\>“recipes”, :action=\>“create”}  
new\_recipe GET /:locale/recipes/new(.:format)  
{:controller=\>“recipes”, :action=\>“new”}  
edit\_recipe GET /:locale/recipes/:id/edit(.:format)  
{:controller=\>“recipes”, :action=\>“edit”}  
recipe GET /:locale/recipes/:id(.:format)  
{:controller=\>“recipes”, :action=\>“show”}  
PUT /:locale/recipes/:id(.:format)  
{:controller=\>“recipes”, :action=\>“update”}  
DELETE /:locale/recipes/:id(.:format)  
{:controller=\>“recipes”, :action=\>“destroy”}  
root /:locale  
{:controller=\>“recipes”, :action=\>“index”}  
/:controller/:action/:id  
/:controller/:action/:id(.:format)

Att.  
Paulo H. Vieira Neves  
Bsc. Sistemas de InformaÃ§Ã£o  
+55 38 9141 5400  
MSN: removed\_email\_address@domain.invalid  
GTALK: removed\_email\_address@domain.invalid  
SKYPE: paulodemoc

2010/4/9 AndrÃ©s gutiÃ©rrez [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 2:19pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/9 "2010-04-09T14:19:07Z")

</div>

I think so, but doesn’t change the fact that I am getting the error…

Att.  
Paulo H. Vieira Neves  
Bsc. Sistemas de InformaÃ§Ã£o  
+55 38 9141 5400  
MSN: removed\_email\_address@domain.invalid  
GTALK: removed\_email\_address@domain.invalid  
SKYPE: paulodemoc

2010/4/9 AndrÃ©s gutiÃ©rrez [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 2:15pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/10 "2010-04-09T14:15:01Z")

</div>

That is correct no?

2010/4/9 Paulo H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> {:controller=\>“mannequins”, :action=\>“edit”}  
> new\_recipe GET /:locale/recipes/new(.:format)  
> {:controller=\>“recipes”, :action=\>“index”}
> 
> > end
> > 
> > > \<% end %\>
> > > 
> > > > \<% end %\>
> > > > 
> > > > > > +55 38 9141 5400
> > > > > > 
> > > > > > > removed\_email\_address@domain.invalid\> wrote:
> > > > > > > 
> > > > > > > > Here is my routes.rb:
> > > > > > > > 
> > > > > > > > # map.connect ‘products/:id’, :controller =\> ‘catalog’, :action
> > > > > > > > 
> > > > > > > > # Sample resource route (maps HTTP verbs to controller actions
> > > > > > > > 
> > > > > > > > controllers/admin/products\_controller.rb)
> > > > > > > > 
> > > > > > > > # Note: These default routes make all actions in every controller
> > > > > > > > 
> > > > > > > > Showing app/views/recipes/index.html.erb where line #15 raised:  
> > > > > > > > To unsubscribe from this group, send email to  
> > > > > > > > To unsubscribe from this group, send email to  
> > > > > > > > To unsubscribe from this group, send email to
> > > > 
> > > > removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > > > removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> > 
> > * * *
> > 
> > .  
> > .  
> > For more options, visit this group at  
> > [http://groups.google.com/group/rails-i18n?hl=en](http://groups.google.com/group/rails-i18n?hl=en).

–  
Experiencia es lo que obtienes, cuando no obtienes lo que quieres.

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 3:03pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/11 "2010-04-09T15:03:06Z")

</div>

Enclosed image:[image: rubyerror.png]  
Att.  
Paulo H. Vieira Neves  
Bsc. Sistemas de InformaÃ§Ã£o  
+55 38 9141 5400  
MSN: removed\_email\_address@domain.invalid  
GTALK: removed\_email\_address@domain.invalid  
SKYPE: paulodemoc

2010/4/9 AndrÃ©s gutiÃ©rrez [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 2:57pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/12 "2010-04-09T14:57:11Z")

</div>

Can you put the complete error please

2010/4/9 Paulo H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> > > ```
> > > mannequins GET /:locale/mannequins(.:format)
> > > 
> > > ```
> > > 
> > > {:controller=\>“mannequins”, :action=\>“update”}  
> > > recipe GET /:locale/recipes/:id(.:format)  
> > > Att.
> > > 
> > > > Do yo have this?
> > > > 
> > > > > ```
> > > > > <td><%=h recipe.author %></td>
> > > > > 
> > > > > ```
> > > > > 
> > > > > Att.
> > > > > 
> > > > > > Sorry are you iterating in a variable named @recipes?  
> > > > > > Can you try this:
> > > > > > 
> > > > > > > > \<%= link\_to 'Show', recipe %\> SKYPE: paulodemoc \>\> things \>\> ActionController::Routing::Routes.draw do |map| \>\> # Keep in mind you can assign values other than :controller \>\> \>\> # products.resources :comments \>\> # end \>\> # consider removing or commenting them out if you're using named \>\> ti.... \>\> removed\_email\_address@domain.invalid \> removed\_email\_address@domain.invalid removed\_email\_address@domain.invalid
> > > > > > > 
> > > > > > > * * *
> > > > > > 
> > > > > > * * *
> > > > > > 
> > > > > > .  
> > > > > > .  
> > > > > > “Caminar sobre el agua y desarrollar software a partir de unas  
> > > > > > For more options, visit this group at  
> > > > > > For more options, visit this group at  
> > > > > > especificaciones es fÃ¡cil. si ambas estÃ¡n congeladas.”  
> > > > > > [http://groups.google.com/group/rails-i18n?hl=en](http://groups.google.com/group/rails-i18n?hl=en).  
> > > > > > [http://groups.google.com/group/rails-i18n?hl=en](http://groups.google.com/group/rails-i18n?hl=en).

–  
Experiencia es lo que obtienes, cuando no obtienes lo que quieres.

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 3:11pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/13 "2010-04-09T15:11:20Z")

</div>

Just for you guys to check:

Routes.rb  
[http://pastie.org/911390](http://pastie.org/911390)

[http://pastie.org/911390](http://pastie.org/911390)Application\_Controller.rb  
[http://pastie.org/911392](http://pastie.org/911392)

If i should put any other files, lemme know…

Att.  
Paulo H. Vieira Neves  
Bsc. Sistemas de InformaÃ§Ã£o  
+55 38 9141 5400  
MSN: removed\_email\_address@domain.invalid  
GTALK: removed\_email\_address@domain.invalid  
SKYPE: paulodemoc

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 3:24pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/14 "2010-04-09T15:24:49Z")

</div>

Try this:  
\<%= link\_to ‘Show’, recipe\_url(:id =\> recipe) %\>

2010/4/9 Paulo H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> Att.
> 
> > something’s wrong with your routes - show it too us. And for the love
> > 
> > > +55 38 9141 5400
> > > 
> > > > > SKYPE: paulodemoc
> > > > > 
> > > > > > > routes’, I got this:  
> > > > > > > {:controller=\>“mannequins”, :action=\>“show”}  
> > > > > > > edit\_recipe GET /:locale/recipes/:id/edit(.:format)  
> > > > > > > /:controller/:action/:id(.:format)  
> > > > > > > 2010/4/9 AndrÃ©s gutiÃ©rrez [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> > > > > > > 
> > > > > > > > Ah! in the console put this:
> > > > > > > > 
> > > > > > > > > But I got the same error.... 2010/4/9 AndrÃ©s gutiÃ©rrez \> removed\_email\_address@domain.invalid\> escribiÃ³: \>\> Line #15 contains the following: \>\>\> MSN: removed\_email\_address@domain.invalid \>\>\>\> \>\>\>\>\> Here is my routes.rb: \>\>\>\>\> # Sample of regular route: \>\>\>\>\> product.id) \>\>\>\>\> \>\>\>\>\> \>\>\>\>\> remember to delete public/index.html. \>\>\>\>\> routes and resources. \>\>\>\>\> recipe\_url failed to generate from {:locale=\>#\>\>\>\> removed\_email\_address@domain.invalid. \>\>\>\> To post to this group, send email to \>\>\> Google G. "rails-i18n" group. \>\> \> \> You received this message because you are subscribed to the Google You received this message because you are subscribed to the Google
> > > > > > > > 
> > > > > > > > Groups “rails-i18n” group.  
> > > > > > > > Groups “rails-i18n” group.  
> > > > > > > > –  
> > > > > > > > To post to this group, send email to removed\_email\_address@domain.invalid.  
> > > > > > > > To post to this group, send email to removed\_email\_address@domain.invalid.  
> > > > > > > > Experiencia es lo que obtienes, cuando no obtienes lo que quieres.  
> > > > > > > > To unsubscribe from this group, send email to  
> > > > > > > > To unsubscribe from this group, send email to  
> > > > > > > > To unsubscribe from this group, send email to  
> > > > > > > > To unsubscribe from this group, send email to  
> > > > > > > > removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > > > > > > > .  
> > > > > > > > For more options, visit this group at  
> > > > > > > > [http://groups.google.com/group/rails-i18n?hl=en](http://groups.google.com/group/rails-i18n?hl=en).

–  
Experiencia es lo que obtienes, cuando no obtienes lo que quieres.

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 3:28pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/15 "2010-04-09T15:28:20Z")

</div>

It worked =]

I changed

\<% @recipes.each do |recipe| %\>

```
<td><%=h recipe.title %></td>

<td><%=h recipe.author %></td>

<td><%=h recipe.description %></td>

<td><%= link_to 'Show', *recipe_url(recipe)* %></td>

<td><%= link_to 'Edit', *edit_recipe_path(recipe)* %></td>

<td><%= link_to 'Destroy', *recipe*, :confirm => 'Are you sure?',

```

> :method =\> :delete %\>

\<% end %\>

to

\<% @recipes.each do |recipe| %\>

```
<td><%=h recipe.title %></td>

<td><%=h recipe.author %></td>

<td><%=h recipe.description %></td>

<td><%= link_to 'Show', *recipe_url(:id => recipe)* %></td>

<td><%= link_to 'Edit', *edit_recipe_path(:id => recipe)* %></td>

<td><%= link_to 'Destroy', *:id => recipe*, :confirm => 'Are you 

```

sure?',

> :method =\> :delete %\>

\<% end %\>

Now I should make the same kind of modifications on the other views…

Att.  
Paulo H. Vieira Neves  
Bsc. Sistemas de InformaÃ§Ã£o  
+55 38 9141 5400  
MSN: removed\_email\_address@domain.invalid  
GTALK: removed\_email\_address@domain.invalid  
SKYPE: paulodemoc

2010/4/9 AndrÃ©s gutiÃ©rrez [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 9, 2010, 3:07pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/16 "2010-04-09T15:07:48Z")

</div>

something’s wrong with your routes - show it too us. And for the love  
of…  
don’t paste a screenshot, use [http://pastie.org/](http://pastie.org/) 🙂

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 10, 2010, 8:36am UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/17 "2010-04-10T08:36:11Z")

</div>

In your position i’ll try this:

This solution has currently one rather big _downside_. Due to the

> _default\_url\_options_ implementation, you have to pass the :id option  
> explicitely, like this: link\_to ‘Show’, book\_url(:id =\> book) and not  
> depend on Railsâ€™ magic in code like link\_to ‘Show’, book. If this should  
> be a problem, have a look at two plugins which simplify work with routes in  
> this way: Sven F.â€™s routing\_filter [1] and Raul M.â€™s  
> translate\_routes [2].

This text is from rails Guides [3]

[1] [GitHub - svenfuchs/routing-filter: routing-filter wraps around the complex beast that the Rails routing system is, allowing for unseen flexibility and power in Rails URL recognition and generation.](http://github.com/svenfuchs/routing-filter/tree/master)  
[2] [GitHub - raul/translate\_routes: Rails plugin to translate your URLs and routing helpers on an clean way.](http://github.com/raul/translate_routes/tree/master)  
[3]  
[Rails Internationalization (I18n) API — Ruby on Rails Guides](http://guides.rubyonrails.org/i18n.html#setting-the-locale-from-the-url-params)

El 9 de abril de 2010 15:28, AndrÃ©s gutiÃ©rrez  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)escribiÃ³:

> > ```
> > <td><%= link_to 'Show', *recipe_url(recipe)* %></td>
> > 
> > <td><%=h recipe.description %></td>
> > 
> > ```
> > 
> > \<% end %\>  
> > SKYPE: paulodemoc
> > 
> > > > Att.
> > > > 
> > > > > something’s wrong with your routes - show it too us. And for the love
> > > > > 
> > > > > > +55 38 9141 5400
> > > > > > 
> > > > > > > > GTALK: removed\_email\_address@domain.invalid
> > > > > > > > 
> > > > > > > > > > I have that on application\_controller.rb, and when I ran 'rake  
> > > > > > > > > > mannequin GET /:locale/mannequins/:id(.:format)  
> > > > > > > > > > {:controller=\>“recipes”, :action=\>“new”}  
> > > > > > > > > > /:controller/:action/:id
> > > > > > > > > > 
> > > > > > > > > > > > \<% @recipes.each do |recipe| %\>
> > > > > > > > > > > > 
> > > > > > > > > > > > > El 9 de abril de 2010 13:29, AndrÃ©s gutiÃ©rrez \<
> > > > > > > > > > > > > 
> > > > > > > > > > > > > > > +55 38 9141 5400
> > > > > > > > > > > > > > > 
> > > > > > > > > > > > > > > > removed\_email\_address@domain.invalid\> wrote:
> > > > > > > > > > > > > > > > 
> > > > > > > > > > > > > > > > > about the :path\_prefix on routes.rb. But it just didn’t  
> > > > > > > > > > > > > > > > > highest priority.
> > > > > > > > > > > > > > > > > 
> > > > > > > > > > > > > > > > > # map.purchase ‘products/:id/purchase’, :controller =\>
> > > > > > > > > > > > > > > > > 
> > > > > > > > > > > > > > > > > # map.resources :products, :member =\> { :short =\> :get,
> > > > > > > > > > > > > > > > > 
> > > > > > > > > > > > > > > > > # products.resources :sales, :collection =\> { :recent
> > > > > > > > > > > > > > > > > 
> > > > > > > > > > > > > > > > > controller  
> > > > > > > > > > > > > > > > > ActionController::RoutingError in Recipes#index  
> > > > > > > > > > > > > > > > > You received this message because you are subscribed to the  
> > > > > > > > > > > > > > > > > –
> > > > > > > > > > > > > > 
> > > > > > > > > > > > > > Edward V. Berard, ingeniero informÃ¡tico.  
> > > > > > > > > > > > > > especificaciones es fÃ¡cil. si ambas estÃ¡n congeladas."  
> > > > > > > > > > > > > > For more options, visit this group at  
> > > > > > > > > > > > > > .
> > > > > > > > > > > 
> > > > > > > > > > > * * *
> > > > > > > > > > > 
> > > > > > > > > > > removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > > > > > > > > > > removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> > > > > > > > > 
> > > > > > > > > * * *
> > > > > > > > > 
> > > > > > > > > .  
> > > > > > > > > .  
> > > > > > > > > “Caminar sobre el agua y desarrollar software a partir de unas  
> > > > > > > > > For more options, visit this group at  
> > > > > > > > > For more options, visit this group at  
> > > > > > > > > For more options, visit this group at  
> > > > > > > > > For more options, visit this group at  
> > > > > > > > > especificaciones es fÃ¡cil. si ambas estÃ¡n congeladas.”  
> > > > > > > > > [http://groups.google.com/group/rails-i18n?hl=en](http://groups.google.com/group/rails-i18n?hl=en).  
> > > > > > > > > [http://groups.google.com/group/rails-i18n?hl=en](http://groups.google.com/group/rails-i18n?hl=en).  
> > > > > > > > > Edward V. Berard, ingeniero informÃ¡tico.

–  
Experiencia es lo que obtienes, cuando no obtienes lo que quieres.

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 10, 2010, 8:51am UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/18 "2010-04-10T08:51:26Z")

</div>

It worked. Now I found another problem… the “Destroy” link doesn’t  
work.  
It doesn’t even prompt anymore, it just refreshes the index page and all  
the  
recipes are still there…  
The link is being generated by this:

_\<%= link\_to ‘Destroy’, :id =\> recipe, :confirm =\> ‘Are you sure?’,  
:method =\> :delete %\>_

Att.  
Paulo H. Vieira Neves  
Bsc. Sistemas de InformaÃ§Ã£o  
+55 38 9141 5400  
MSN: removed\_email\_address@domain.invalid  
GTALK: removed\_email\_address@domain.invalid  
SKYPE: paulodemoc

2010/4/9 AndrÃ©s gutiÃ©rrez [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 10, 2010, 12:28pm UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/19 "2010-04-10T12:28:00Z")

</div>

The solution of :id =\> whatever dosn’t the Rails Way IMHO. You should  
try to  
use the rails helpers (link\_to, form\_for,…) in the correct way:

\<%= link\_to “Show”, recipe %\>

To solve your problems with routes i suggess you to use some of the  
solutions i recomend you in the other mail.

If you prefer my “bad” solutions to make the destroy link work, try  
this:

\<%= link\_to ‘Destroy’, recipe\_path(:id =\> recipe) , :confirm =\> ‘Are you  
sure?’, :method =\> :delete\* \*%\>

2010/4/9 Paulo H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> Paulo H. Vieira Neves
> 
> > f| %\>  
> > [http://groups.google.com/group/rails-i18n?hl=en](http://groups.google.com/group/rails-i18n?hl=en).

–  
Experiencia es lo que obtienes, cuando no obtienes lo que quieres.

---

<div class="post-metadata">

**Author:** ![Paulo\_HSVSNeves](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e47774/32.png) [@Paulo\_HSVSNeves](https://www.ruby-forum.com/u/Paulo_HSVSNeves)\
**Post date:** [April 10, 2010, 8:37am UTC](https://www.ruby-forum.com/t/locale-parameter-on-url/186564/20 "2010-04-10T08:37:57Z")

</div>

It worked too…  
Now I am having the same error on these lines:

_\<% form\_for(@recipe) do |f| %\>_  
\<%= f.error\_messages %\>

=/

Att.  
Paulo H. Vieira Neves  
Bsc. Sistemas de InformaÃ§Ã£o  
+55 38 9141 5400  
MSN: removed\_email\_address@domain.invalid  
GTALK: removed\_email\_address@domain.invalid  
SKYPE: paulodemoc

2010/4/9 AndrÃ©s gutiÃ©rrez [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

[Next page](https://www.ruby-forum.com/t/locale-parameter-on-url/186564.md?page=2)
