Class: Nrb::Commands::Destroy
- Defined in:
- lib/nrb/commands/destroy.rb
Overview
This command destroys a resource, and if it is a model, it also destroys the correspnding create migration file.
Instance Method Summary collapse
Methods inherited from Resource
#ensure_valid_resource, valid_resources
Methods inherited from Inside
Methods inherited from Base
Instance Method Details
#destroy_migration ⇒ Object
12 13 14 15 16 17 |
# File 'lib/nrb/commands/destroy.rb', line 12 def destroy_migration return false unless resource == 'model' prefix = 'db/migrate/*_create_' migration_file = Dir["#{prefix}#{name.underscore.pluralize}.rb"].first remove_file(migration_file, opts) if migration_file end |
#destroy_resource ⇒ Object
8 9 10 |
# File 'lib/nrb/commands/destroy.rb', line 8 def destroy_resource remove_file target("#{name.underscore}.rb"), opts end |