i have been upgrading rails 4, , after running command "rspec ." getting following error:
/users/lexi87/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-4.0.0.rc1/lib/action_dispatch/routing/mapper.rb:1297:in `member': can't use member outside resource(s) scope (argumenterror)
i have changed route file little , still no work. if has run similar issue , has fix please share me. in advance!
dating::application.routes.draw 'signup' => 'users#new' 'login' => 'sessions#new' 'logout' => 'sessions#destroy' 'edit' => 'users#edit' "/profile/:id" => "users#show" "profile/:id/settings" => 'users#edit' 'settings/:id' => 'users#settings' resources :sessions resources :password_resets resources :galleries resources :photos resources :searches resources :questions resources :answers, only: [:new, :create] end resources :users member :settings end end root to: 'galleries#index' resources :users |user| resources :messages collection post 'delete_multiple' 'settings', on: :member end end end
i think problem here:
resources :messages collection post 'delete_multiple' 'settings', on: :member # <--here end end
you can't define member inside collection, should move resources block, this:
resources :messages collection post 'delete_multiple' end 'settings', on: :member end
remember member route require id, because acts on member. collection route doesn't because acts on collection of objects. can't use both @ same time.
Comments
Post a Comment