Create document from database

Hi all,
I am newbie to ruby. I am creating web based data management tool
using ruby on rails. I’ve done with interface and data management. Now
I want to create a document from database. I want my database values
should reflect in standard doc format, like a template. How can I do
it in ruby. I am using MySQL-front as back-end.
Please help me out.