Make gem work with and without rails