Class: HistoryModelGenerator

Inherits:
Rails::Generator::NamedBase
  • Object
show all
Defined in:
lib/backlog_jira/generators/history_model/history_model_generator.rb

Instance Method Summary collapse

Instance Method Details

#manifestObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/backlog_jira/generators/history_model/history_model_generator.rb', line 4

def manifest
  record do |m|
#      # Check for class naming collisions.
    m.class_collisions class_path, "#{class_name}History"
#      m.class_collisions class_path, "#{class_name}HistoryTest"
#
#      # Model, test, and fixture directories.
    m.directory File.join('app/models', class_path)
#      m.directory File.join('test/unit', class_path)
#      m.directory File.join('test/fixtures', class_path)
#
#      # Model class, unit test, and fixtures.
    m.template 'model.rb',      File.join('app/models', class_path, "#{file_name}_history.rb")
#      m.template 'unit_test.rb',  File.join('test/unit', class_path, "#{file_name}_history_test.rb")
#      m.template 'fixtures.yml',  File.join('test/fixtures', class_path, "#{table_name}_history.yml")

    m.dependency 'model', ["#{class_name}History"], :collision => :skip, :skip_migration => true

    unless options[:skip_migration]
      m.dependency 'history_migration', [class_name], :collision => :skip, :skip_migration => true
    end
  end
end