Class: Notifications::Generators::ControllersGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/notifications/controllers_generator.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#copy_controllersObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/generators/notifications/controllers_generator.rb', line 9

def copy_controllers
  %w(notifications).each do |fname|
    path = "#{Rails.root}/app/controllers/notifications/#{fname}_controller.rb"
    if File.exists?(path)
      puts "Skipping notifications/#{fname}_controller.rb creation, as file already exists!"
    else
      puts "Adding controller (notifications/#{fname}_controller.rb)..."
      template "notifications/#{fname}_controller.rb", path
    end
  end
end