Skip to content

Instantly share code, notes, and snippets.

@AJFaraday
Created June 13, 2011 14:33
Show Gist options
  • Save AJFaraday/1022872 to your computer and use it in GitHub Desktop.
Save AJFaraday/1022872 to your computer and use it in GitHub Desktop.
annoyance
# in config/routes.rb
FestivePage::Application.routes.draw do
resources :vouchers
resources :mailouts do
member do
get 'distribute'
end
end
resources :logos
resources :pictures
resources :sponsors
resources :food_stores
resources :workshops
resources :venues
resources :acts
resources :user_sessions
resources :pages
# paypal notifications
match '/ppnotify' => "payment_notifications#create"
# user sessions
match '/login' => "user_sessions#new"
match '/logout' => "user_sessions#destroy"
root :to => 'main#index'
match '/:controller(/:action(/:id))'
match '/:action(/:id(/:code))', :controller => :main
# for advert resource
resources :adverts do
member do
get 'position'
get 'payment'
post 'pay'
end
end
# rake routes | grep advert
position_advert GET /adverts/:id/position(.:format) {:action=>"position", :controller=>"adverts"}
payment_advert GET /adverts/:id/payment(.:format) {:action=>"payment", :controller=>"adverts"}
pay_advert POST /adverts/:id/pay(.:format) {:action=>"pay", :controller=>"adverts"}
adverts GET /adverts(.:format) {:action=>"index", :controller=>"adverts"}
POST /adverts(.:format) {:action=>"create", :controller=>"adverts"}
new_advert GET /adverts/new(.:format) {:action=>"new", :controller=>"adverts"}
edit_advert GET /adverts/:id/edit(.:format) {:action=>"edit", :controller=>"adverts"}
advert GET /adverts/:id(.:format) {:action=>"show", :controller=>"adverts"}
PUT /adverts/:id(.:format) {:action=>"update", :controller=>"adverts"}
DELETE /adverts/:id(.:format) {:action=>"destroy", :controller=>"adverts"}
# problem, POST request to '/adverts' goes to index method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment