recreating some Rails features