using such route : map.namespace(:hubs) do |hub| hub.resources :settings, :member => { :general => :get } end I get : general_hubs_setting /hubs/settings/:id/general {:action=>"general", :controller=>"hubs/settings"} but I would like to get /hubs/:id/settings/general {:action=>"general", :controller=>"hubs/settings" with params[:id] 1 what kind of route I should use ? thanks for your help
using such route : map.namespace(:hubs) do |hub| hub.resources :settings, :member => { :general => :get } end I get : general_hubs_setting /hubs/settings/:id/general {:action=>"general", :controller=>"hubs/settings"} but I would like to get /hubs/:id/settings/general {:action=>"general", :controller=>"hubs/settings" with params[:id] 1 what kind of route I should use ? thanks for your help
Well you have a namespace for hubs thats why there is no id for the hubs map.resources :hubs do |hub| hub.resources :settings, :collection => { :general => :get } end That will give you this: /hubs/:hub_id/settings/general
Freddy Andersen wrote:> Well you have a namespace for hubs thats why there is no id for the > hubs > > map.resources :hubs do |hub| > hub.resources :settings, :collection => { :general => :get } > end > > That will give you this: > > /hubs/:hub_id/settings/generalThanks Fred... ( I was reading the most recent doc ''Rails Routing from the Outside In'' but I just started few minutes ago... ) this is fine but general should be a resource ( action will be standard ''edit'') I''ll have also permissions, profile and personal.. (and one setting per hub) so I wrote map.resources :hubs do |hub| hub.resource :settings do |setting| setting.resource :general, :controller => "hub/settings/general" end end this gives me : edit_hub_settings_general GET /hubs/:hub_id/settings/general/edit(.:format) {:action=>"edit", :controller=>"hub/settings/general"} which is fine... I have a general.rb in app/controllers/hub/settings however, when executing I get the following error : uninitialized constant Hub::Settings::GeneralController how should I name my class ? erwin -- Posted via http://www.ruby-forum.com/.
> edit_hub_settings_general GET > /hubs/:hub_id/settings/general/edit(.:format) > {:action=>"edit", :controller=>"hub/settings/general"} > > which is fine... > > I have a general.rb in app/controllers/hub/settings > however, when executing I get the following error : > > uninitialized constant Hub::Settings::GeneralController > > how should I name my class ? > > erwinGOT IT... I used: class Hub::Settings::GeneralController < ApplicationController but I did a mistake I should use a general_controller.rb , not general.rb thanks for your tip ! -- Posted via http://www.ruby-forum.com/.