Sha256: 480b606e4c5b7bc6fa9ca972f40260757a9c6d7ed1d4fd1713e7e36a42530102

Contents?: true

Size: 594 Bytes

Versions: 1

Compression:

Stored size: 594 Bytes

Contents

require 'rails/generators/migration'

class HasCommentsGenerator < Rails::Generators::Base
  include Rails::Generators::Migration
  source_root File.expand_path('../templates', __FILE__)
  
  def create_model_file
    template "comment.rb","app/models/comment.rb"
  end
  
  def create_migration_file
    migration_template "create_comments.rb","db/migrate/create_comments.rb"
  end
  
  def create_controller_file
    template "comments_controller.rb","app/controllers/comments_controller.rb"
  end
  
  def self.next_migration_number(path)
    Time.now.utc.strftime("%Y%m%d%H%M%S")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
has_comments-0.3.0 lib/generators/has_comments_generator.rb