The view files are located in the app/views
directory.
Eucalypt looks for view files relative to the app/views
directory by default (though you can change this in the core application file).
If your views
folder structure is like the following:
views├── partials├── layouts├── index.erb└── 404.erb
Then you can render the pages index.erb
and 404.erb
in the following way:
app/controllers/main_controller.rbclass MainController < ApplicationControllerhelpers MainHelper if defined? MainHelperget '/' doerb :indexenderror Sinatra::NotFound doerb :"404"endend
If your views
folder structure is like the following (with some views located within sub-directories):
views├── partials├── layouts├── pages│ ├── index.erb│ └── about.erb└── 404.erb
Then you can render the pages index.erb
and 404.erb
in the following way (note the specification of the full path relative to app/views
for rendering the index
page):
app/controllers/main_controller.rbclass MainController < ApplicationControllerhelpers MainHelper if defined? MainHelperget '/' doerb :"pages/index"enderror Sinatra::NotFound doerb :"404"endend