Make sure Rails is defined before using it