Attempting to make it backwards compatible with rails 3