views:

653

answers:

1

Related to the question asked here -- http://stackoverflow.com/questions/182040/default-segment-name-in-rails-resources-routing.

Having trouble in edge rails trying to generate resources without a namespace prefix (i.e. /:apple_id/oranges/). Using the plugin gives me //:apple_id/oranges?

Any easier way to do this? Maybe a 2.2 issue?

+1  A: 

what I did was put the whole thing out of namespace altogether

map.resources :fruits, :path_prefix => ":apple_id", :name_prefix => "apple_"

and it would be

                                 apple_fruits GET    /:apple_id/fruits                                    {:controller=>"fruits", :action=>"index"}
                       formatted_apple_fruits GET    /:apple_id/fruits.:format                            {:controller=>"fruits", :action=>"index"}
                                              POST   /:apple_id/fruits                                    {:controller=>"fruits", :action=>"create"}
                                              POST   /:apple_id/fruits.:format                            {:controller=>"fruits", :action=>"create"}
                              new_apple_fruit GET    /:apple_id/fruits/new                                {:controller=>"fruits", :action=>"new"}
                    formatted_new_apple_fruit GET    /:apple_id/fruits/new.:format                        {:controller=>"fruits", :action=>"new"}
                             edit_apple_fruit GET    /:apple_id/fruits/:id/edit                           {:controller=>"fruits", :action=>"edit"}
                   formatted_edit_apple_fruit GET    /:apple_id/fruits/:id/edit.:format                   {:controller=>"fruits", :action=>"edit"}
                                  apple_fruit GET    /:apple_id/fruits/:id                                {:controller=>"fruits", :action=>"show"}
                        formatted_apple_fruit GET    /:apple_id/fruits/:id.:format                        {:controller=>"fruits", :action=>"show"}
                                              PUT    /:apple_id/fruits/:id                                {:controller=>"fruits", :action=>"update"}
                                              PUT    /:apple_id/fruits/:id.:format                        {:controller=>"fruits", :action=>"update"}
                                              DELETE /:apple_id/fruits/:id                                {:controller=>"fruits", :action=>"destroy"}
                                              DELETE /:apple_id/fruits/:id.:format                        {:controller=>"fruits", :action=>"destroy"}

this worked for me, hoped it worked for you too :)

Sikachu