Class: CommentsGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- CommentsGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/comments/comments_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
10 11 12 |
# File 'lib/generators/comments/comments_generator.rb', line 10 def self.next_migration_number(path) Time.now.utc.strftime("%Y%m%d%H%M%S") end |
.source_root ⇒ Object
6 7 8 |
# File 'lib/generators/comments/comments_generator.rb', line 6 def self.source_root @lazy_comments_source_root ||= File.("../templates", __FILE__) end |
Instance Method Details
#add_controller ⇒ Object
14 15 16 |
# File 'lib/generators/comments/comments_generator.rb', line 14 def add_controller copy_file "controllers/comments_controller.rb", "app/controllers/comments_controller.rb" end |
#add_model ⇒ Object
18 19 20 21 |
# File 'lib/generators/comments/comments_generator.rb', line 18 def add_model copy_file "models/comment.rb", "app/models/comment.rb" migration_template "comments_table.rb", "db/migrate/create_comments.rb" end |
#add_views_and_assets ⇒ Object
23 24 25 |
# File 'lib/generators/comments/comments_generator.rb', line 23 def add_views_and_assets directory "views/comments", "app/views/comments" end |