27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/generators/transcribable_generator.rb', line 27
def copy_files
if Transcribable.new_columns && Transcribable.new_columns.length > 0
@migration_name = "add_#{Transcribable.new_columns.keys.join("_and_")}_to_transcriptions"
migration_template 'migration_add_columns.rb', "db/migrate/#{@migration_name}.rb"
elsif !ActiveRecord::Base.connection.tables.include?("transcriptions")
migration_template 'migration.rb', 'db/migrate/create_transcriptions_table.rb'
end
template 'controller.rb', 'app/controllers/transcriptions_controller.rb'
template 'model.rb', 'app/models/transcription.rb'
template 'views/layouts/simple_frame.html.erb', 'app/views/layouts/simple_frame.html.erb'
template 'views/_form.html.erb', 'app/views/transcriptions/_form.html.erb'
template 'views/new.html.erb', 'app/views/transcriptions/new.html.erb'
template 'assets/stylesheets/simple_frame.css', 'app/assets/stylesheets/simple_frame.css'
template 'config/documentcloud.yml', 'config/documentcloud.yml'
route "resources :transcriptions, :only => [:new, :create]"
route "resources :#{@table.to_sym}, :only => [:index, :show]"
route "root :to => \"#{@table}#index\""
end
|