View templates HTML tags provide static web pages only but ERB tags give us dynamic information in that HTML template. To view the template file, go to Rails application >> app >> View>> Home folder where the templates files are available.
As @Chowlett mentioned before, erb stands for Embedded Ruby. When you define any file as ". html. erb" that means it's an HTML file with ruby code embedded in it and it is similar to ". rhtml" extension of rails file.
Script written in ERB, a templating language for Ruby; may include any type of plain text or source code, but also includes Ruby ERB code that generates additional text into the resulting file when run with the ERB template engine. ERB is often used for templating Web files such as .
If I have the following Sinatra code:
get '/hi' do
erb :hello
end
This works great if I have a file called views/hello.erb
. However if I have a file called views/hello.html.erb
Sinatra can't find the file and gives me an error. How do I tell Sinatra I want it to look for .html.erb
as a valid .erb extension?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With