0

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.

4
  • I m using Linux mint, rails 4 and everything is updated with all gems Commented Aug 16, 2015 at 10:54
  • yep, just did. it says : "no route matches [GET] "/shop.html". It is giving me a Routes helper where It is asking me to provide a path/url. I tried copying the path from the directory but it say Path Matching (/eshop/public): No matches found. Commented Aug 16, 2015 at 11:01
  • You didn't even read any rails tutorial, did you? Commented Aug 16, 2015 at 11:09
  • Read about ruby on rails views first, bro. Commented Aug 16, 2015 at 11:10

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

If it worked make sure to mark the answer as correct
Works for me on Ruby on Rails 7.1.3.4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.