lib/generators/trestle/auth/admin/admin_generator.rb in trestle-auth-0.3.0 vs lib/generators/trestle/auth/admin/admin_generator.rb in trestle-auth-0.4.0
- old
+ new
@@ -4,13 +4,19 @@
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