Add check if Rails is defined