Q:

Generate rtf document in Rails 3.2

I'm a rails newbie.   Could someone tell me if there is a quick and easy way to generate rtf documents for people to download using rails? 
For example if I have "views/users/show.html.erb" the view normally outputs to html so I want to people to be able to download as an identical rtf document? 

A:

ruby-rtf is the gem you are looking for.  There are some examples of rtf generation here
Add this to initializers/mime_types.rb:
Mime::Type.register "text/richtext", :rtf

Code to give you an idea:
document = RTF::Document.new(RTF::Font.new(RTF::Font::ROMAN, 'Times New Roman'))
document.paragraph do |p|
   p << "This is the first sentence in the paragraph. " 
   p << "This is the second sentence in the paragraph. " 
   p << "And this is the third sentence in the paragraph." 
end

send_file document, :type=>"text/richtext"

