Sha256: fa365f7d06abc62c9592269177272215d5c8ab40a6613adedee3fe64f2b17822

Contents?: true

Size: 913 Bytes

Versions: 1

Compression:

Stored size: 913 Bytes

Contents

Has Random Token
===============================
Has Random Token is a helper to create random tokens for model attributes in Ruby on Rails. The tokens generated are Base64 strings.

Install
-------------------------------

`gem install 'has_random_token'`

or in your `Gemfile`

`gem 'has_random_token'` and then `bundle`

Usage
-------------------------------

```ruby
class Session < ActiveRecord::Base
	has_random_token
end
```

or

```ruby
class Session < ActiveRecord::Base
	has_random_token attribute: :code, length: 64, unique: true
end
```

Configuration
-------------------------------
* The default column name is `token`. You can customize it by setting the `attribute` option.
* By default, it doesn't verify the token is unique. In order to verify uniqueness, you can set the `unique` option to true.
* The default token length is 32 characters. You can customize it by setting the `length` option.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
has_random_token-0.1.0 README.md