Added guard and started with some testing
More tests
Removed depreciated method in Rails 4