My page index.htmlfor my project needs some Ruby code, so I need to change it to an extension .erb. How to configure Rails to identify a file index.html.erbas a project start page instead of a file index.html?
index.html
.erb
index.html.erb
You need to configure the path map.rootin the file config/routes.rb.
map.root
config/routes.rb
map.root :controller => "blogs" # This would recognize http://www.example.com/ as params = { :controller => 'blogs', :action => 'index' } # and provide these named routes root_url # => 'http://www.example.com/' root_path # => ''
http://api.rubyonrails.org/classes/ActionController/Routing.html
public / index.html is a flat file and does not go through any templates (everything in / public / looks like this.)
, . URL map.root:
map.root :controller => 'home'
Or you can make root for:
config / routes.rb
root to: 'index.html.erb'
Be sure to delete the index.html file
The answers here are out of date. Assuming the file index.html.erbis under the controller and is called "patients". In rails 3 you would do it like this:
match "/" => "patients#index"
Source: https://habr.com/ru/post/1711832/More articles:How to make ASP.Net invalidate (and therefore reload) the current application instance? - asp.netAppend! in the diagram? - appendHow to configure DataSource in Java to connect to MS SQL Server? - javaParsing Header + MIME - erlangMulti-platform mobile application - mobileImplementing a custom Python authentication handler - pythonWhy can't I pull ushort out of System.Object and then use it as uint? (C #) - castingNSSortDescriptor for comparing CLLocation objects in Cocoa / iPhone - sortingОбработка аутентификации и прокси-серверов с помощью httplib2 - pythonMoving objects in the center of mass viewing - language-agnosticAll Articles