Handle attributes in a way that works with rails 3 or 4