make it compatible for both Rails3 & 4