1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

added documentation for replacing #find_template

This commit is contained in:
krissi 2014-05-30 16:38:15 +02:00
parent f7dfcb35a5
commit a5c4367a4c

View file

@ -1231,6 +1231,23 @@ end
Renders `./views/index.myat`. See https://github.com/rtomayko/tilt to Renders `./views/index.myat`. See https://github.com/rtomayko/tilt to
learn more about Tilt. learn more about Tilt.
### Using Custom Logic for Template Lookup
To implement your own template lookup mechanism you can write your
own `#find_template` method:
``` ruby
configure do
set :views [ './views/a', './views/b' ]
end
def find_template(views, name, engine, &block)
Array(views).each do |v|
super(v, name, engine, &block)
end
end
```
## Filters ## Filters
Before filters are evaluated before each request within the same Before filters are evaluated before each request within the same