Class: Wallets::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Wallets::Generators::InstallGenerator
- Includes:
- ActiveRecord::Generators::Migration
- Defined in:
- lib/generators/wallets/install_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dir) ⇒ Object
13 14 15 |
# File 'lib/generators/wallets/install_generator.rb', line 13 def self.next_migration_number(dir) ActiveRecord::Generators::Base.next_migration_number(dir) end |
Instance Method Details
#create_initializer ⇒ Object
21 22 23 |
# File 'lib/generators/wallets/install_generator.rb', line 21 def create_initializer template "initializer.rb", "config/initializers/wallets.rb" end |
#create_migration_file ⇒ Object
17 18 19 |
# File 'lib/generators/wallets/install_generator.rb', line 17 def create_migration_file migration_template "create_wallets_tables.rb.erb", File.join(db_migrate_path, "create_wallets_tables.rb") end |
#display_post_install_message ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/wallets/install_generator.rb', line 25 def say "\n🎉 The `wallets` gem has been installed.", :green say "\nTo complete the setup:" say " 1. Run 'rails db:migrate' to create the wallet tables." say " ⚠️ If you want a custom table prefix, set config.table_prefix in config/initializers/wallets.rb before migrating.", :yellow say " 2. Add 'has_wallets' to any model that should own wallets." say " 3. Adjust config/initializers/wallets.rb for your default asset, categories, and callbacks." say " 4. Use owner.wallet(:asset_code) to start crediting, debiting, and transferring value." say "\nYou now have an append-only wallet ledger with balances, allocations, and transfers.\n", :green end |