class AttacheRails::UpgradeV2ToV3Generator
Public Class Methods
has_many_attaches(name)
click to toggle source
# File lib/generators/attache_rails/upgrade_v2_to_v3_generator.rb, line 39 def self.has_many_attaches(name) $has_many_attaches.push([self.name, name]) end
has_one_attache(name)
click to toggle source
# File lib/generators/attache_rails/upgrade_v2_to_v3_generator.rb, line 35 def self.has_one_attache(name) $has_one_attache.push([self.name, name]) end
next_migration_number(dir)
click to toggle source
# File lib/generators/attache_rails/upgrade_v2_to_v3_generator.rb, line 7 def self.next_migration_number(dir) ActiveRecord::Generators::Base.next_migration_number(dir) end
source_root()
click to toggle source
# File lib/generators/attache_rails/upgrade_v2_to_v3_generator.rb, line 11 def self.source_root @source_root ||= File.expand_path('../templates', __FILE__) end
Public Instance Methods
generate_migration()
click to toggle source
# File lib/generators/attache_rails/upgrade_v2_to_v3_generator.rb, line 15 def generate_migration migration_template "upgrade_v2_to_v3_migration.rb.erb", "db/migrate/#{migration_file_name}" end
migration_class_name()
click to toggle source
# File lib/generators/attache_rails/upgrade_v2_to_v3_generator.rb, line 27 def migration_class_name migration_name.camelize end
migration_file_name()
click to toggle source
# File lib/generators/attache_rails/upgrade_v2_to_v3_generator.rb, line 23 def migration_file_name "#{migration_name.underscore}.rb" end
migration_name()
click to toggle source
# File lib/generators/attache_rails/upgrade_v2_to_v3_generator.rb, line 19 def migration_name "UpgradeAttacheFieldsFromV2ToV3" end