Class: PricingPlans::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/generators/pricing_plans/install/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dir) ⇒ Object



14
15
16
# File 'lib/generators/pricing_plans/install/install_generator.rb', line 14

def self.next_migration_number(dir)
  ActiveRecord::Generators::Base.next_migration_number(dir)
end

Instance Method Details

#create_initializerObject



22
23
24
# File 'lib/generators/pricing_plans/install/install_generator.rb', line 22

def create_initializer
  template "initializer.rb", "config/initializers/pricing_plans.rb"
end

#create_migration_fileObject



18
19
20
# File 'lib/generators/pricing_plans/install/install_generator.rb', line 18

def create_migration_file
  migration_template "create_pricing_plans_tables.rb.erb", File.join(db_migrate_path, "create_pricing_plans_tables.rb"), migration_version: migration_version
end

#display_post_install_messageObject



26
27
28
29
30
31
32
33
# File 'lib/generators/pricing_plans/install/install_generator.rb', line 26

def display_post_install_message
  say "\n✅ pricing_plans has been installed.", :green
  say "\nNext steps:"
  say "  1. Run 'rails db:migrate' to create the necessary tables."
  say "  2. Review and customize your plans in 'config/initializers/pricing_plans.rb'."
  say "  3. Add the model mixin (PricingPlans::PlanOwner) and attribute limits to your plan owner model (e.g., User, Organization)."
  say "  4. Use the controller guards and helper methods to gate access to features based on the active plan. Read the README and the docs for information on all available methods."
end