Class: HasModerated::Generators::InstallGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



7
8
9
# File 'lib/generators/has_moderated/install/install_generator.rb', line 7

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

Instance Method Details

#create_migrationsObject



16
17
18
19
20
21
22
# File 'lib/generators/has_moderated/install/install_generator.rb', line 16

def create_migrations
  Dir["#{self.class.source_root}/migrations/*.rb"].sort.each do |filepath|
    name = File.basename(filepath)
    migration_template "migrations/#{name}", "db/migrate/#{name.gsub(/^\d+_/,'')}"
    sleep 1
  end
end

#filesObject



11
12
13
14
# File 'lib/generators/has_moderated/install/install_generator.rb', line 11

def files
  # class_collisions 'Moderation'
  template 'moderation.rb', File.join('app/models', 'moderation.rb')
end