Sha256: 7b96d630c5cd6c539cfba93a20d0cd77b43a636c15d894d37eba8479e56b6ad3

Contents?: true

Size: 769 Bytes

Versions: 7

Compression:

Stored size: 769 Bytes

Contents

module Trestle
  module Auth
    module Generators
      class AccountGenerator < ::Rails::Generators::Base
        desc "Creates a Trestle admin for managing the logged in user"

        argument :model, type: :string, default: "Administrator"

        class_option :devise, type: :boolean, default: false, desc: "Create admin for a Devise user model"

        source_root File.expand_path("../templates", __FILE__)

        def create_admin
          template "admin.rb.erb", "app/admin/auth/account_admin.rb"
        end

        def devise?
          options[:devise]
        end

      protected
        def parameter_name
          singular_name
        end

        def singular_name
          model.demodulize.underscore
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
trestle-auth-0.5.0 lib/generators/trestle/auth/account/account_generator.rb
trestle-auth-0.5.0.pre2 lib/generators/trestle/auth/account/account_generator.rb
trestle-auth-0.5.0.pre lib/generators/trestle/auth/account/account_generator.rb
trestle-auth-0.4.4 lib/generators/trestle/auth/account/account_generator.rb
trestle-auth-0.4.3 lib/generators/trestle/auth/account/account_generator.rb
trestle-auth-0.4.2 lib/generators/trestle/auth/account/account_generator.rb
trestle-auth-0.4.1 lib/generators/trestle/auth/account/account_generator.rb