class Quickery::Generators::MigrationGenerator
Public Instance Methods
attributes_with_index()
click to toggle source
# File lib/generators/quickery/migration/migration_generator.rb, line 39 def attributes_with_index attributes.select { |a| !a.reference? && a.has_index? } end
generate_migration()
click to toggle source
# File lib/generators/quickery/migration/migration_generator.rb, line 14 def generate_migration migration_template("migration.rb.erb", "db/migrate/#{migration_file_name}.rb", migration_version: migration_version) end
migration_class_name()
click to toggle source
# File lib/generators/quickery/migration/migration_generator.rb, line 28 def migration_class_name migration_name.camelize end
migration_file_name()
click to toggle source
# File lib/generators/quickery/migration/migration_generator.rb, line 24 def migration_file_name "#{migration_name}" end
migration_name()
click to toggle source
# File lib/generators/quickery/migration/migration_generator.rb, line 20 def migration_name "add_quickery_#{attributes.map(&:name).join("_")}_to_#{name.underscore.pluralize}" end
migration_version()
click to toggle source
# File lib/generators/quickery/migration/migration_generator.rb, line 32 def migration_version if Rails.version.start_with? "5" "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end end