Sha256: 9f2ed751b53d4411f5eefeec8861ad220cb754fb8a23f9e162e120106394b3fc

Contents?: true

Size: 756 Bytes

Versions: 1

Compression:

Stored size: 756 Bytes

Contents

require "rails/generators/active_record"

module Authtrail
  module Generators
    class InstallGenerator < Rails::Generators::Base
      include ActiveRecord::Generators::Migration
      source_root File.join(__dir__, "templates")

      def copy_migration
        migration_template "login_activities_migration.rb", "db/migrate/create_login_activities.rb", migration_version: migration_version
      end

      def copy_templates
        template "initializer.rb", "config/initializers/authtrail.rb"
      end

      def generate_model
        template "login_activity_model.rb", "app/models/login_activity.rb"
      end

      def migration_version
        "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
authtrail-0.3.0 lib/generators/authtrail/install_generator.rb