Home

Awesome

HasTokenOn

Simple yet customizable token generator for Rails 3.

Features

Examples

Initialization

Options

Options are as follows:

Generator

has_token_on comes with a generator that generates a migration for token.

Usage:
  rails generate has_token_on:config MODEL NAME [options]

Options:
  [--length=N]             # Token length
  [--create-on=CREATE_ON]  # Create on: initialize, create, update
  [--with-index]           # Index the token field (default: es)
                           # Default: true
  [--unique]               # Is token unique?
                           # Default: true

Runtime options:
  -f, [--force]    # Overwrite files that already exist
  -p, [--pretend]  # Run but do not make any changes
  -q, [--quiet]    # Supress status output
  -s, [--skip]     # Skip files that already exist

Description:
  Generates a migration that adds token field a model. Modifies model code.

Example:
  rails g has_token_on:config paste token

Testing

Tested on Mac OS X with Ruby 1.9.2. Should work on Ruby 1.8.7+.

You may use guard for continuous testing

bundle exec guard

NB it will try to install some OSX specific gems like 'rb-fsevent'.

License

Copyright (c) 2011 Saulius Grigaliunas, released under the MIT license