README.md in friendly_id-5.4.2 vs README.md in friendly_id-5.5.0

- old
+ new

@@ -102,9 +102,30 @@ ```ruby User.find_each(&:save) ``` +## Options + +### `:allow_nil` + +You can pass `allow_nil: true` to the `friendly.find()` method if you're want to +avoid raising `ActiveRecord::RecordNotFound` and accept a `nil`. + +#### Example + +```ruby +MyModel.friendly.find("bad-slug") # where bad-slug is not a valid slug +MyModel.friendly.find(123) # where 123 is not a valid primary key ID +MyModel.friendly.find(nil) # maybe you have a variable/param that's potentially nil +#=> raise ActiveRecord::RecordNotFound + +MyModel.friendly.find("bad-slug", allow_nil: true) +MyModel.friendly.find(123, allow_nil: true) +MyModel.friendly.find(nil, allow_nil: true) +#=> nil +``` + ## Bugs Please report them on the [Github issue tracker](https://github.com/norman/friendly_id/issues) for this project.