Sha256: 025549a67f9f41c8a4b76daa0d92af5f030c1b79044480302f4f9c0e568eb36b

Contents?: true

Size: 743 Bytes

Versions: 1

Compression:

Stored size: 743 Bytes

Contents

module Trestle
  module Auth
    module Generators
      class AdminGenerator < ::Rails::Generators::Base
        desc "Creates a Trestle admin for managing Administrators"

        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", File.join('app/admin/auth', "#{model.underscore.pluralize}_admin.rb")
        end

        def devise?
          options[:devise]
        end

      protected
        def plural_name
          model.demodulize.underscore.pluralize
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trestle-auth-0.4.0 lib/generators/trestle/auth/admin/admin_generator.rb