I am currently reading Jose Valim’s newest book, Crafting Rails Applications. It digs into the newest Rails 3 APIs, extending ActiveModel, Railties, Generators, Responders, etc… I truly recommend it if you are already familiar with Rails.
Back to the main topic of the post, I would like to share two projects that I have been working on with the book, the first of them is a PDF Renderer for Rails. I never thought it would be so easy to extend Rails’ native renderer so it can render other type of files like PDFs, CSVs, etc… You can browse the code on the repository and notice it is fairly simple to include such functionality. Pull requests anyone?
The latest project I have been involved with is a simple extension of ActiveModel, which I decided to call FFMail (as in Form for mail). It extends ActiveModel to use ActionMailer and send emails through a contact form. It is very easy to add this to your Rails application (check out the instructions on github) and I even included a couple of extra functionalities like I18n internationalization for the emails and a very simple spam detector without needing a captcha. The way I did this was basically to hide a form field through CSS , namely “Nickname” that users would never fill (who on earth fills forms through manual POST requests aside from Richard Stallman??) but some robots will fill it and hence the mail would not be sent.
Links to the projects –
RRPDF – PDF Renderer for Rails – https://github.com/eLobato/RRPDF
FFMail – Contact form for Rails extending ActiveModel – https://github.com/eLobato/FFMail