move rails specific logic into its own area