Home>

I renamed the old project name part of the contents of all files other than the cache to the new project name with grep -rl.
Rails s still gives me a site not found error.

Postscript: Excuse me.
I have a project called hoge, but I wanted to rename it to fuga, and I wondered if it would work just by changing the routing part.

hoge/config/initializers/hoge.rb

Rails.application.configure do
  config.hoge = {
    staff: {host: "hoge.test.com", path: ""},
    admin: {host: "hoge.test.com", path: "admin"}
  }
end


routes.rb

Rails.application.routes.draw do
  config = Rails.application.config.hoge
  constraints host: config [: staff] [: host] do
    namespace: staff, path: config [: staff] [: path] do
      root "top # index"
    end
  end
  constraints host: config [: admin] [: host] do
    namespace: admin, path: config [: admin] [: path] do
      root "top # index"
    end
  end
end


Replaced hoge part with fuga including file name. The rails server starts, but I can't connect with the above address.

  • Answer # 1

    If you have a question "I want to change the project name", please use the rename gem after returning it to a working state with the original project name hoge.

    Official: https://github.com/morshedalam/rename/
    How to use: https://qiita.com/ryoya-s/items/66e426f1a0dd5d87cd6f