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.

Bick
  • 17,833
  • 52
  • 146
  • 251
  • I found the answer in another thread http://stackoverflow.com/questions/7829480/no-route-matches-get-assets – Bick Apr 29 '12 at 18:21

2 Answers2

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.

ksol
  • 11,835
  • 5
  • 37
  • 64
  • answer is here - http://stackoverflow.com/questions/7829480/no-route-matches-get-assets – Bick Apr 29 '12 at 18:22
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

Compunutter
  • 159
  • 2
  • 10
  • 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. – Bick Apr 29 '12 at 17:22
  • @perry Have a look at this question, I think this is what you mean: http://stackoverflow.com/questions/5631145/routing-to-static-html-page-in-public – Compunutter Apr 29 '12 at 17:29
  • this only changes the url in the address. but the html is not found yet – Bick Apr 29 '12 at 18:03