1

I am working on a project where I am upgrading a Rails 2.3 application to Rails 3.1. There is one thing which I am not able to figure out. Below is a route defined in a Rails 2.3 application:

map.resources :segments, :collection => { :listen => :get, :comment => :post, :inside => :post, :around => :post , :suggest => :get, :ipeds => :get, :search_ipeds => :get }, :member => { :listen => :get }, :has_many => [ :photos , :school_statistics, :comments, :ad_spots ] do |segments|
    segments.resources :visits , :only => [ :index ], :collection => { :destroy_all => :delete }
  end

I am not sure how to write this route using Rails 3.1 to perform the same functionality which this route is performing using Rails 2.3. I searched online to find some resources which explains this and also I read the routes documentation on the Ruby on Rails website but I still can't get it.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Smoke
  • 1,052
  • 1
  • 10
  • 24

1 Answers1

0

free coding here but I guess this would do it for you

resources :segments do
  collection do
    get 'listen' 
    post 'comment'
    post 'inside'
    post 'around'
    get 'suggest'
    get 'ipeds'
    get 'search_ipeds'
  end 
  member do
    get 'listen'
  end
  resources :photos 
  resources :school_statistics
  resources :comments
  resources :ad_spots
  resources :visits , :only => [ :index ] do 
    delete 'destroy_all', :on => :collection
  end
end