Sha256: b76e0fc214d896f9eca23329d0cede068071a9a6fceb99e613dd03d6bf9b870c
Contents?: true
Size: 686 Bytes
Versions: 8
Compression:
Stored size: 686 Bytes
Contents
require 'rails/generators' require 'rails/generators/active_record/migration/migration_generator' class SqlMigrationGenerator < ActiveRecord::Generators::MigrationGenerator class_option :location, :type => :string, :default => "db/migrate" def create_migration_file set_local_assigns! validate_file_name! migration_name = "#{file_name}.rb" migration_template "migration.rb", File.join(options[:location], migration_name) end def source_paths [File.join(File.dirname(__FILE__), "templates")] end protected def validate_file_name! unless file_name =~ /^[_a-z0-9]+$/ raise IllegalMigrationNameError.new(file_name) end end end
Version data entries
8 entries across 8 versions & 1 rubygems