Class: Trestle::Auth::Generators::ModelGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/trestle/auth/model/model_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_modelObject



9
10
11
# File 'lib/generators/trestle/auth/model/model_generator.rb', line 9

def create_model
  generate "model", "#{name} email:string password_digest:string first_name:string last_name:string remember_token:string remember_token_expires_at:datetime"
end

#inject_model_methodsObject



13
14
15
# File 'lib/generators/trestle/auth/model/model_generator.rb', line 13

def inject_model_methods
  inject_into_file "app/models/#{name.underscore}.rb", "  include Trestle::Auth::ModelMethods\n  include Trestle::Auth::ModelMethods::Rememberable\n", before: /^end/
end