README.md in public_id-0.5.0 vs README.md in public_id-1.0.0
- old
+ new
@@ -22,11 +22,11 @@
```
Tell your activerecord object that ident is your new public identifier.
```ruby
class User < ActiveRecord::Base
- publically_identified_by :ident
+ has_public_id :ident
# Automatically defines to_param as :ident
end
User.new.ident
# => "use-ECNrdIzvCBh8jg"
@@ -54,24 +54,24 @@
end
```
* Get a new random ID for your own nefarious purposes:
- ``` User.new_public_identifier ```
+ ``` User.new_public_id ```
### Configuration
By default, ID's have 2 components.
A 3 character lowercase prefix of their originating class name and a suffix of a 14 character random, unique, base64 url safe string.
The suffix and prefix are joined by a dash.
You can skip the prefix alltogether:
```ruby
- publically_identified_by column_name, length: 10, prefix: false
+ has_public_id column_name, length: 10, prefix: false
```
or set it directly:
```
- publically_identified_by other_column_name, length: 15, prefix: 'user_'
+ has_public_id other_column_name, length: 15, prefix: 'user_'
```
The "length" option refers to the length argument passed to SecureRandom. The actual length
of the random base64 string will be about 4/3's this length. The defaults to 10, for a
14 character base64 string.