Mall::Engine.routes.draw do

  devise_for :users, controllers: {confirmations: 'confirmations'}

  devise_scope :user do
    patch "/confirm" => "confirmations#confirm"
  end

  resources :users, only: [:show], constraints: { id: BSON_ID_REGEX }

  resources :addresses, except: [:index]

  resources :products, only: [:index, :show], constraints: { id: BSON_ID_REGEX } do
    collection do
      get 'categories/:category', action: :index, as: 'category', constraints: { category: /[a-zA-Z0-9~-]+/i }
    end
  end

  resources :shopping_carts, except: [:index], constraints: { id: BSON_ID_REGEX } do
    delete '/remove_item/:id', action: 'remove_item', as: 'remove_item'
    match '/add_item/:id', action: 'add_item', as: 'add_item', via: [:get, :post]
  end

  get '/' => 'shop#index'
  get 'search' => 'shop#search'
  resources :orders, except: [:index]
end

Mall::Engine.routes.draw do

  devise_for :users, controllers: {confirmations: 'confirmations'}, :class_name => "Mall::User"

  devise_scope :user do
    patch "/confirm" => "confirmations#confirm"
  end

  resources :users, only: [:show], constraints: { id: BSON_ID_REGEX }

  resources :addresses, except: [:index]

  resources :products, only: [:index, :show], constraints: { id: BSON_ID_REGEX } do
    collection do
      get 'categories/:category', action: :index, as: 'category', constraints: { category: /[a-zA-Z0-9~-]+/i }
    end
  end

  resources :shopping_carts, except: [:index], constraints: { id: BSON_ID_REGEX } do
    delete '/remove_item/:id', action: 'remove_item', as: 'remove_item'
    match '/add_item/:id', action: 'add_item', as: 'add_item', via: [:get, :post]
  end

  get '/' => 'shop#index'
  get 'search' => 'shop#search'
  resources :orders, except: [:index]
end

Revert "Minor fix to routing"
Revert "Minor fix to routing"

This reverts commit bf02845a3847615e1491274c310fa98814510c32.
