Class: SimpleNotificationGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/simple_notification/simple_notification_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate_controllerObject



17
18
19
# File 'lib/generators/simple_notification/simple_notification_generator.rb', line 17

def generate_controller
  copy_file "notifications_controller.rb", "app/controllers/notifications_controller.rb"
end

#generate_migrationObject



9
10
11
# File 'lib/generators/simple_notification/simple_notification_generator.rb', line 9

def generate_migration
  migration_template "create_notifications.rb.erb", "db/migrate/create_notifications.rb"
end

#generate_modelObject



13
14
15
# File 'lib/generators/simple_notification/simple_notification_generator.rb', line 13

def generate_model
  copy_file "notification.rb", "app/models/notification.rb"
end

#generate_viewObject



21
22
23
24
25
26
# File 'lib/generators/simple_notification/simple_notification_generator.rb', line 21

def generate_view
  empty_directory "app/views/notifications"
  copy_file "notifications_index.html.haml", "app/views/notifications/index.html.haml"
  copy_file "notifications_partial.html.haml", "app/views/notifications/_show.html.haml"
  copy_file "notifications_css.css.scss", "app/assets/stylesheets/notifications.css.scss"
end