Tag Archives: namespace

Nesting Resources in Rails Routes.Rb with Namespaces

When I have a controller that takes more than one has_many argument, I think about creating a namespace. This way I may still use my forums, pages controllers w/out needing any conditional logic, testing for the presence of :course_id in the params hash. #config/routes.rb map.namespace :courses, :path_prefix=>'/courses/:course_id' do |courses| courses.resources :forums courses.resources :pages end map.resources :courses map.resources [...]
Posted in Ruby on Rails | Also tagged , , , , | Leave a comment

Namespacing in Rails

With namespace routes in Rails you can easily create a prefix for select resources. For instance, if you have an admin area or an account dashboard you can give logged in users access to methods that are not otherwise available. To use namespaces define them in config/routes.rb. *Note: this is available for the latest release [...]
Posted in Ruby on Rails | Also tagged , , | Leave a comment