Prev | Current Page 418 | Next

Brad Ediger

"Advanced Rails"

edit_url
end
end
end
Markaby can be installed as a Rails plugin from http://code.whytheluckystiff.net/svn/
markaby/trunk. Once installed, you can create templates that use Markaby by giving
them a .mab extension.
Liquid
Liquid (http://www.liquidmarkup.org/), by Tobias L??tke, is another alternative Rails
template engine. Its main advantage is that it is secure. It does not eval any of its
input; it only substitutes provided values into a template with some optional filters.
This division of labor has several advantages:
Simplicity
There are only a few basic constructs in Liquid: the simple ones are literal
HTML code, variable interpolation, filters, conditionals, and loops. This makes
the templates clean and easy to understand, which is an advantage when the
designer is not a developer.
Replacing Rails Components | 283
Logical separation
The inability to execute code in the views forces model- and controller-related
code into the models and the controllers. This helps encourage good boundaries
and separation of concerns appropriate for a web application.
Security
Because the Ruby environment is protected against dangerous or malicious code
in the templates, you can use Liquid to give customers or users access to templates
without security concerns.
To get started with Liquid and Rails, install the Liquid plugin from http://liquidmarkup.
googlecode.com/svn/trunk.


Pages:
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430