Class: HasCommentsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/has_comments_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



19
20
21
# File 'lib/generators/has_comments_generator.rb', line 19

def self.next_migration_number(path)
  Time.now.utc.strftime("%Y%m%d%H%M%S")
end

Instance Method Details

#create_controller_fileObject



15
16
17
# File 'lib/generators/has_comments_generator.rb', line 15

def create_controller_file
  template "comments_controller.rb","app/controllers/comments_controller.rb"
end

#create_migration_fileObject



11
12
13
# File 'lib/generators/has_comments_generator.rb', line 11

def create_migration_file
  migration_template "create_comments.rb","db/migrate/create_comments.rb"
end

#create_model_fileObject



7
8
9
# File 'lib/generators/has_comments_generator.rb', line 7

def create_model_file
  template "comment.rb","app/models/comment.rb"
end