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:
parent
f7dfcb35a5
commit
a5c4367a4c
1 changed files with 17 additions and 0 deletions
17
README.md
17
README.md
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue