0
votes

Hi I'm trying to deploy an app made with help of "Agile web development by S.Ruby" and I always get the same error - The page you were looking for doesn't exist.

You may have mistyped the address or the page may have moved.

I've already tried to migrate my DB on Heroku - that wasn't the case.I think something is wrong with routes.rb file, but I can't understand what is incorrect exactly,please help me to solve this problem

Here is my routes.rb file:

Depot::Application.routes.draw do
  get 'admin' => 'admin#index'

  controller :sessions do
    get  'login' => :new
    post 'login' => :create
    delete 'logout' => :destroy
  end

  get "sessions/create"
  get "sessions/destroy"

  resources :users

  resources :products do
    get :who_bought, on: :member
  end

  scope '(:locale)' do
    resources :orders
    resources :line_items
    resources :carts
    root 'store#index', as: 'store', via: :all
  end
end
1
You don't have root path set so going to your project.heroku.com will give you a 404 for sure!Mike Szyndel

1 Answers

2
votes

As Michal correctly points out you miss the root path. You have defined a route inside the scope you use to get to the different locales, but not a global root. This is not a Heroku problem, it won't work on your local server either.

So, http://your_server.com/en will work, but http://your_server.com will not.

You need to add a root path outside all scopes, like so:

root 'store#index'

You will have to set a default locale or something like that. You can leave the other root directive inside the scope, as you have named it explicitly (with as: 'store') there won't be any conflict.