Hello,
I have some rails resources with complementary parameters to the :id one. For example :
map.resources :users, :controller => 'users', :path_prefix => ':lang'
So that I'd have the lang prefixed to the URL.
The default generated url methods would be :
user_url(lang, user)
However the lang is always the same parameter. For example params[:lang] or user.lang.
So I'd be looking for a clean way to define this lang parameter without passing it in the user_url method parameters.
Until now I'm using helpers. But redefining all those methods is not very clean. And an helper is not valid in the controller when the user_url method should be.
I did also try to add them to a lib module so that they'd be available in the controller and in the view. However I see then a problem with rspec. Even though I include the library, the methods used are the rails defaultly generated ones.
Would you have any idea how I could clear that up ? :p