README.md in hashid-rails-0.3.2 vs README.md in hashid-rails-0.4.0

- old
+ new

@@ -27,15 +27,30 @@ ```shell $ gem install hashid-rails ``` -## Usage +## Basic Usage -Just use `Model#find` passing in the hashid instead of the model id: +Just use `Model#find` passing in the hashid instead of the model id. ```ruby @person = Person.find(params[:hashid]) +``` + +## Alternative Usage + +You can use the `Model#find_by_hashid` method to find a record without falling +back on the standard `find` method. This can be useful in cases where the hashid +might be misinterpreted by the `find` method, such as using a hashid containing +only numbers that could be both interpreted as either an id and or a hashid. + +```ruby +# When a record is found, it returns the record. +@person = Person.find_by_hashid(params[:hashid]) + +# When no record, is found it raises an exception. +ActiveRecord::RecordNotFound ``` ## Configuration To customize the Hashids seed and ensure that another user of the gem cannot