Sha256: 2aa61d54c67cdd5d5b5f705c20efe32c524aa32fb29d60baeb81ac310f3f605f

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

require "generators/active_record/devise_generator"

module Identity
  class InstallGenerator < ActiveRecord::Generators::DeviseGenerator
    source_root File.expand_path("../templates", __FILE__)
    def config_file
      template "identity.rb", "config/initializers/identity.rb"
    end

    def model_contents
<<RUBY
  include Identity::Mixins::User
RUBY
    end

    def migration_data
<<RUBY
      # To enable/disable users from admin area
      t.boolean :active,            null: false, default: true

      ## Database authenticatable
      t.string :email,              null: false, default: ""
      t.string :encrypted_password, null: false, default: ""

      ## Recoverable
      t.string   :reset_password_token
      t.datetime :reset_password_sent_at

      ## Rememberable
      t.datetime :remember_created_at

      ## Trackable
      t.integer  :sign_in_count, default: 0, null: false
      t.datetime :current_sign_in_at
      t.datetime :last_sign_in_at
      t.#{ip_column} :current_sign_in_ip
      t.#{ip_column} :last_sign_in_ip

      ## Confirmable
      t.string   :confirmation_token
      t.datetime :confirmed_at
      t.datetime :confirmation_sent_at
      t.string   :unconfirmed_email # Only if using reconfirmable

      ## Omniauthable
      t.string :provider
      t.string :uid
RUBY
      end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
anadea-identity-0.4.2 lib/generators/identity/install_generator.rb
anadea-identity-0.4.1 lib/generators/identity/install_generator.rb
anadea-identity-0.4.0 lib/generators/identity/install_generator.rb