Sha256: a728e610c44dfc4da5f96d052525b8c175b9102cfdc5e601d294f17b4f7fb3f0

Contents?: true

Size: 514 Bytes

Versions: 1

Compression:

Stored size: 514 Bytes

Contents

require 'nrb/commands/concerns/resource_generator'

module Nrb
  module Commands
    class Destroy < Commands::Resource
      desc 'Destroy a generated resource.'

      def destroy_resource
        remove_file target("#{name.underscore}.rb"), opts
      end

      def destroy_migration
        return false unless resource == 'model'
        migration_file = Dir["db/migrate/*_create_#{name.underscore.pluralize}.rb"].first
        remove_file(migration_file, opts) if migration_file
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nrb-1.1.0 lib/nrb/commands/destroy.rb