Sha256: 819fc0499d223dc9171078e070be765f9c153bbd01d8a6566da3461c20c46d3e

Contents?: true

Size: 538 Bytes

Versions: 14

Compression:

Stored size: 538 Bytes

Contents

class CommentableGenerator < Rails::Generators::NamedBase
  source_root File.expand_path('../templates', __FILE__)
  include Rails::Generators::Migration

  def self.source_root
    @_acts_as_commentable_source_root ||= File.expand_path("../templates", __FILE__)
  end

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

  def create_model_file
    template "comment.rb", "app/models/#{file_path}.rb"
    migration_template "create_comments.rb", "db/migrate/create_#{plural_table_name}.rb"
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
acts_as_commentable_more-1.2.11 lib/generators/commentable/commentable_generator.rb
acts_as_commentable_more-1.2.10 lib/generators/commentable/commentable_generator.rb
acts_as_commentable_more-1.2.9 lib/generators/commentable/commentable_generator.rb
acts_as_commentable_more-1.2.8 lib/generators/commentable/commentable_generator.rb
acts_as_commentable_more-1.2.7 lib/generators/commentable/commentable_generator.rb
acts_as_commentable_more-1.2.6 lib/generators/commentable/commentable_generator.rb
acts_as_commentable_more-1.2.5 lib/generators/commentable/commentable_generator.rb
acts_as_commentable_more-1.2.4 lib/generators/commentable/commentable_generator.rb
acts_as_commentable_more-1.2.3 lib/generators/commentable/commentable_generator.rb
acts_as_commentable_more-1.2.2 lib/generators/commentable/commentable_generator.rb
acts_as_commentable_more-1.2.1 lib/generators/commentable/commentable_generator.rb
acts_as_commentable_more-1.2.0 lib/generators/commentable/commentable_generator.rb
acts_as_commentable_more-1.1.0 lib/generators/commentable/commentable_generator.rb
acts_as_commentable_more-1.0.0 lib/generators/commentable/commentable_generator.rb