README.md in token_attr-0.1.0 vs README.md in token_attr-0.2.0
- old
+ new
@@ -4,26 +4,26 @@
## Installation
Add `token_attr` to your Gemfile:
- gem 'token_attr', '~> 0.1.0'
+ gem 'token_attr', '~> 0.2.0'
## Usage
```
class User < ActiveRecord::Base
- include TokenAttr
+ include TokenAttr::Concern
token_attr :token
end
user = User.new
user.valid?
user.token # => "b8bd30ff"
```
-The token is generated in a `before_validation` callback.
+The token is generated in a `before_validation` callback only if the it's `nil`.
### Options
#### Length
@@ -46,13 +46,13 @@
- `:numeric` - any number
- `:alphanumeric` - any character or number
- a string - a string of your choice of the characters you want to use
```
-token_attr :token, alphabet: :numeric # => "82051173"
-token_attr :token, alphabet: :alphabetic # => "xqnInSJa"
+token_attr :token, alphabet: :numeric # => "82051173"
+token_attr :token, alphabet: :alphabetic # => "xqnInSJa"
token_attr :token, alphabet: :alphanumeric # => "61nD0lUo"
-token_attr :token, alphabet: "token" # => "ktnekoet"
+token_attr :token, alphabet: "token" # => "ktnekoet"
```
## Contributing
1. Fork it ( http://github.com/mbillard/token_attr/fork )