The Hitchhiker’s Guide to Ruby On Rails Galaxy

Records of my voyage through RoR Galaxy

Archive for February, 2009

Two of the best help & guide sites for RubyOnRails and Ruby

Posted by arjunghosh on February 27, 2009

Well this is essentially a note to self and well to others too.
The best help documents online for Ruby On Rails and Ruby are these AJAXified websites which allows real-time searching of sytanx and commands.

For Ruby On Rails, it is:

www.railsbrain.com

And for Ruby, we have:

www.rubybrain.com

And the best part is you can even download them so that you can use it offline!

Another good resource for Rails documentaion and help guides is the newly created collaborative effort Rails Guide project. This was started by @lifo as a project to give the rails community a good documentaion which was painfully lacking till now. Since its a collaborative effort, you can participate here. There is even buzz about this project on @twitter

Advertisements

Posted in Uncategorized | Tagged: , , , , , , | Leave a Comment »

Using ERB as a dynamic template to create a file whose contents are dynamic

Posted by arjunghosh on February 17, 2009

The following code will create a temporary file for say attaching a vcard file to email.The following code is dynamic to use ERB as a template to create the file dynamically every time with the variable “telephone”,”location”,”email” which gets binded to the ERB file and is under scope.
The code is:-

{
telephone = “347-27456”
location = “New Delhi”
email = “xyz@gmail.com”
vcard = ERB.new( File.open(‘address.vcard.erb’ ){ |f| f.read } ).result( binding )
f = File.new(“temp_file.vcf”,”wb”)
f.puts vcard
f.close
}

and in pastie is here

Posted in Uncategorized | Tagged: , , , , , , , | 1 Comment »