class ActivityNotification::Generators::ModelsGenerator

Notification generator to create customizable notification model from templates. @example Run notification generator to create customizable notification model

rails generate activity_notification:models users

Constants

MODELS

Public Instance Methods

create_models() click to toggle source

Create notification model in application directory

# File lib/generators/activity_notification/models_generator.rb, line 36
def create_models
  @target_prefix = target.blank? ? '' : (target.camelize + '::')
  models      = options[:models] || MODELS
  model_names = options[:names]  || MODELS
  models.zip(model_names).each do |original_name, new_name|
    @model_name = new_name.camelize
    template "#{original_name}.rb",
             "app/models/#{target}/#{@model_name.underscore}.rb"
  end
end
show_readme() click to toggle source

Shows readme to console

# File lib/generators/activity_notification/models_generator.rb, line 48
def show_readme
  readme "README" if behavior == :invoke
end