making it backwards compatible to rails 3