Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add generator for authem:model

  • Loading branch information...
commit ba624e2a5d579ea7c2eb97c5f180ff0bdb61edf5 1 parent 4389231
Micah Cooper and Travis Anderson authored Hashrocket Workstation committed
Showing with 17 additions and 0 deletions.
  1. +17 −0 lib/generators/authem/model/model_generator.rb
View
17 lib/generators/authem/model/model_generator.rb
@@ -0,0 +1,17 @@
+require 'rails/generators/base'
+
+module Authem
+ class ModelGenerator < Rails::Generators::Base
+
+ argument :model_name, type: :string, default: "user"
+
+ def generate_model
+ generate("model #{model_name} email:string, password_digest:string, reset_password_token:string, session_token:string")
+ end
+
+ def update_model_to_include_authem
+ insert_into_file "app/models/#{model_name}.rb", "\n include Authem::User\n\n", after: "class #{model_name.camelize} < ActiveRecord::Base\n"
+ end
+
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.