0

I need some assistance in creating a simple html page and locate it in the server.

Since I couldnt find it in the doc I tried to put a index2.html file in the /public library and when I tried to get receive it using

http://127.0.0.1:3000/index2.html

or

http://127.0.0.1:3000/public/index2.html

and receiver

ActionController::RoutingError (No route matches [GET] "/public/index2.html"): 
  1. how do I get the html from the server
  2. how di I make it the default.

Thanks.

EDIT : thanks for your answers. I am looking for the simplest way to work. in many tutorials it says you can put it in the public folder and thats it. This will same me useless controllers.

1

2 Answers 2

2

You can do that in several ways : the more obvious would be to have an action in one of your controller (or a new one, whatever) that does nothing (except render the view), and add a route to it. There is other ways to achieve this too, with more adapted tools. I never used any of them, so might want to google it (static page rails), but I know one of them is a gem called High Voltage. Hope this serves you well.

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

1 Comment

1

I think you might have mis-understood Rails...

I have never used it but I think I can probably help you with your answer. Rails is the most popular MVC framework for the language Ruby, hence 'Ruby on Rails'. Here is a link to the MVC framework this may help you understand it: http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

With the MVC framework you can't 'get' a file directly through the URL. You have to get it through the routing engine. Usually you do this through a Controller which renders a view, typically, from a model.

It's difficult to explain if you don't understand how the MVC framework works but once you have an understanding you should be able to develop web applications very rapidly.

Have a look here for creating your first rails app: http://guides.rubyonrails.org/getting_started.html

3 Comments

Thanks a lot for your kind comment. really :-). I have already built a small site all with ruby's implementation of MVC . The thing is - sometimes I need a small html page that will have info and links only. (help pages, backoffice pages ) . Since it is even easier to create a simple html file and since I dont ever need any dynamic chacnge, I thought maybe there's an option for that. thanks.
@perry Have a look at this question, I think this is what you mean: stackoverflow.com/questions/5631145/…
this only changes the url in the address. but the html is not found yet

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.