aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands/destroy/destroy_command.rb
blob: 5e6b7f93715bbd02f1ef7976492592138b4c1017 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require "rails/generators"

module Rails
  module Command
    class DestroyCommand < Base
      def help # :nodoc:
        Rails::Generators.help self.class.command_name
      end

      def perform(*)
        generator = args.shift
        return help unless generator

        require_application_and_environment!
        Rails.application.load_generators

        Rails::Generators.invoke generator, args, behavior: :revoke, destination_root: Rails.root
      end
    end
  end
end