stringex
stringex copied to clipboard
Add support for nil scope values (such as deleted_at), with unit test
Current scope implementation fails if one or more of the scope attribute values is nil.
One may want to use nullable values as scope parameters when using stringex/acts_as_url in combination with a 'soft-delete' solution such as https://github.com/JackDanger/permanent_records
In this case, 'live' records will have a nil value for the deleted_at column, but deleted records will have a specific value. By including the deleted_at column in the acts_as_url scope, one can ensure that url slugs for live records will be unique, while also avoiding having 'deleted' records polluting the available URL space.