Enrutamiento de páginas en Ruby on Rails
Frecuentes
Visto 40 veces
-1
I am new in RoR. I just added a new page hello.html in public folder. When I try to load the page on browser I get following error
No route matches [GET] "/hello.html"
Try running rake routes for more information on available routes.
I found some solution so far but they don't really working for me. I tried following lines in routes.rb file
match '/hello', to: '#hello'
match 'hello', to: 'hello'
match '/hello' => '#hello', :as => 'hello'
But Im getting same error. I know that for files in public folder I don't need to add routes but Still I get the same error.
1 Respuestas
2
For any files added in the public folder, you don't need to add routes. If the file is available as
public/hello.html
Its accessible via localhost:3000/hello.html
Simple! No routes.
respondido 27 nov., 13:06
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas ruby-on-rails or haz tu propia pregunta.
Yes I know that for files in public folder I don't need to add routes but Still I get the same error. - asdfkjasdfjk
Did you clear the sample routes that you have mentioned in the question? - satya kalluri
Also, did you start from a basic-rails-app? or are you using any existing app? because, there is a way in Rails to change the default-public-directory. Ensure that it ain't the case. stackoverflow.com/questions/4600364/… - satya kalluri
Yes I cleared those sample and I started from basic rails app - asdfkjasdfjk
Why don't you show us your codebase. Put it in GutHub and send it across. This should not take more than a min. - satya kalluri