views:

36

answers:

0

I have a problem with routing with an id conditioned by a regex constraint.

My route is:

  resources :albums, :constraints => { :id =>/[a-zA-Z\d\.\-\_]+$/ } do
    get :offline, :on => :member
  end

If I do this:

GET /content/v1/albums/:id(.:format) {:action=>"show", :controller=>"content/v1/albums", :id=>/[a-zA-Z\d\.\-\_]+$/

It works

BUT

this does not work:

GET /content/v1/albums/:id/offline(.:format) {:action=>"offline", :controller=>"content/v1/albums", :id=>/[a-zA-Z\d\.\-\_]+$/}  **doesn't work**

Meaning:http://localhost:3000/content/v1/albums/com.domain.sub/offline

Although the path:

offline_content_v1_album_path('com.domain.sub')

gives me:

/content/v1/albums/com.domain.sub/offline

I am not a routing expert but I am sure there might be an obscure way to achieve this.