Class: Testimonials::Generators::PromptEventsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration, MigrationHelpers
Defined in:
lib/generators/testimonials/prompt_events/prompt_events_generator.rb

Overview

For apps that installed with --skip-prompt-events and later want auto-prompts: creates the testimonials_prompt_events table, the ledger the throttle reads. A full install already has it. Additive and safe — nothing reads or writes the table until config.prompt_events is true.

bin/rails generate testimonials:prompt_events && bin/rails db:migrate

Instance Method Summary collapse

Instance Method Details

#create_migration_fileObject



23
24
25
26
# File 'lib/generators/testimonials/prompt_events/prompt_events_generator.rb', line 23

def create_migration_file
  migration_template 'create_testimonials_prompt_events.rb.tt',
                     'db/migrate/create_testimonials_prompt_events.rb'
end

#post_installObject



28
29
30
31
32
# File 'lib/generators/testimonials/prompt_events/prompt_events_generator.rb', line 28

def post_install
  say "\nPrompt history table queued. Run `rails db:migrate`, then set", :green
  say 'config.prompt_events = true in config/initializers/testimonials.rb to let'
  say 'testimonial_prompt! auto-open the widget again.'
end