class Notifications::Generators::InstallGenerator

Public Instance Methods

add_initializer() click to toggle source
# File lib/generators/notifications/install_generator.rb, line 8
def add_initializer
  path = "#{Rails.root}/config/initializers/notifications.rb"
  if File.exist?(path)
    puts "Skipping config/initializers/notifications.rb creation, as file already exists!"
  else
    puts "Adding Notifications initializer (config/initializers/notifications.rb)..."
    template "config/initializers/notifications.rb", path
  end
end
add_migrations() click to toggle source
# File lib/generators/notifications/install_generator.rb, line 32
def add_migrations
  exec("rake notifications:install:migrations")
end
add_models() click to toggle source
# File lib/generators/notifications/install_generator.rb, line 18
def add_models
  path = "#{Rails.root}/app/models/notification.rb"
  if File.exist?(path)
    puts "Skipping notification.rb creation, as file already exists!"
  else
    puts "Adding model (notification.rb)..."
    template "app/models/notification.rb", path
  end
end
add_routes() click to toggle source
# File lib/generators/notifications/install_generator.rb, line 28
def add_routes
  route 'mount Notifications::Engine => "/notifications"'
end