Wednesday, June 27, 2012

Affiliate system in Ruby on Rails

Ruby on Rails shines all around, but especially when you consider community of high quality developers and architects that was build around it.

There is plenty of code and gems written for it, but surprisingly not that many open source products that you could use "out of the box". For example, recently my client needed an affiliate system. My first call was to google it. Plenty of systems in php, but none in RoR. Anyone?

Tuesday, June 19, 2012

Validating non-persistent models in Rails 3

Some times it happens that we need to validate entity that is short lived and not persisted anywhere. It is very easy to do in Rails 3 - just include
include ActiveModel::Validations
in your model and that's it - you can call
object.valid?
now to test it's correctness.

keep your heroku dyno up

I have many apps that use single dyno. The problem with such apps is, that after 1h of inactivity heroku puts them to sleep, and waking up process takes from 5 to 30 seconds depending on your slug size. To avoid your first visitor wait for heroku to spin up your dyno I use uptimerobot.com that pings specified url every 5 minutes.