Sha256: 2650c9ffa7d834f60ed428e1ba9d518d5338227996395a65ed9994d1bd4cac91

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

# JTRailsTokenizable

[![Gem Version](https://badge.fury.io/rb/jt-rails-tokenizable.svg)](http://badge.fury.io/rb/jt-rails-tokenizable)

JTRailsTokenizable generates tokens for ActiveRecord models in Ruby On Rails.

## Installation

JTRailsTokenizable is distributed as a gem, which is how it should be used in your app.

Include the gem in your Gemfile:

    gem 'jt-rails-tokenizable', '~> 1.0'

## Usage

### Basic usage

```ruby
class User < ActiveRecord::Base
	tokenize :my_token_field
	tokenize :another_token_field, size: 20, validations: false
	...
end
```

You change the length of the token (128 by default) and disable the presence and uniqueness validations.

A new unique token is generated at the creation of the model. You can generate a new token with:

```ruby
my_instance.generate_new_token(:my_token_field)
my_instance.save
```

## Author

- [Jonathan Tribouharet](https://github.com/jonathantribouharet) ([@johntribouharet](https://twitter.com/johntribouharet))

## License

JTRailsTokenizable is released under the MIT license. See the LICENSE file for more info.

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jt-rails-tokenizable-1.0.5 README.md
jt-rails-tokenizable-1.0.4 README.md
jt-rails-tokenizable-1.0.3 README.md