Aditya Shukla
Aditya Shukla

Reputation: 11

loading html page into rails server

I created the whole responsive site in notepad - shop.html. I can see its directory in rails. Put all my files in public folder of its rails app. Now I dont know how to load it in localhost:3000. How do i do that. Have configured everything. Rails server is running and It shows only the default index.html file. But when i write rails generate controller eshop. It says uninitialized constant welcome error. PS: i m new to ruby. All guides show how to create a new app but I couldnt find a way to load a html page already created in editor to load in browser using rails server. Thanks in advance.

Upvotes: 0

Views: 1380

Answers (1)

Mr. Z.
Mr. Z.

Reputation: 348

Since you generated a controller you need to put the content from your shop.html file into the /views/eshop/index.html.erb file

Open the routes file under config/routes.rb and change the following line

from:

root "welcome#index"

to:

root "eshop#index"

this way your app will point to the right file.


Subsequently you could just point the root to the shop.html file which I do not recommend. However you should definitely look into routing in rails and how it works.

Upvotes: 2

Related Questions