Rails namespaceless routing (2.2)

Related to the question asked here - The default segment name in rails resource routing .

Having problems with edges 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 issue 2.2?

0


source to share


1 answer


what i did was completely excluded from namespace

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

and it will



                                 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"}

      

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

+2


source







All Articles