Skip to content

Instantly share code, notes, and snippets.

@Locke23rus
Created February 19, 2013 08:16
Show Gist options
  • Select an option

  • Save Locke23rus/4983968 to your computer and use it in GitHub Desktop.

Select an option

Save Locke23rus/4983968 to your computer and use it in GitHub Desktop.
Rails routes.
# Стандартные роуты для collection
# pages GET /pages(.:format) pages#index
# POST /pages(.:format) pages#create
# new_page GET /pages/new(.:format) pages#new
#
# Стандартные роуты для member
# edit_page GET /pages/:id/edit(.:format) pages#edit
# page GET /pages/:id(.:format) pages#show
# PUT /pages/:id(.:format) pages#update
# DELETE /pages/:id(.:format) pages#destroy
#
# Кастомные роуты для collection
# search_pages GET /pages/search(.:format) pages#search
# my_pages GET /pages/my(.:format) pages#my
#
# Кастомные роуты для member
# approve_page PUT /pages/:id/approve(.:format) pages#approve
# disable_page PUT /pages/:id/disable(.:format) pages#disable
resources :pages do
member do
put :approve
put :disable
end
collection do
get :search
get :my
end
end
# collection - роуты в этом блоке указывают на коллекцию объектов, указанных в ресурсе.
# member - роуты в этом блоке указывают на конкретный объект из ресурса.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment