Class: Kanina::SubscriptionGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/kanina/subscription/subscription_generator.rb

Overview

Kanina::SubscriptionGenerator generates a subscription file, for example:

rails generate subscription user_notification

Instance Method Summary collapse

Instance Method Details

#create_subscription_fileObject

This method is called automatically by rails when you generate the subscription. It sets up the subscriptions folder, then adds the subscription to it.


14
15
16
17
18
# File 'lib/generators/kanina/subscription/subscription_generator.rb', line 14

def create_subscription_file
  subscriptions_folder = Rails.root + 'app/subscriptions'
  empty_directory subscriptions_folder
  template 'subscription.rb', subscriptions_folder + "#{file_name}_subscription.rb"
end