Class: Organizations::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/generators/organizations/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/organizations/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/organizations/install/install_generator.rb', line 22

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

#create_migration_fileObject



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

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

#display_post_install_messageObject



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

def display_post_install_message
  say "\nāœ… organizations has been installed.", :green
  say "\nNext steps:"
  say "  1. Run 'rails db:migrate' to create the necessary tables."
  say "  2. Review and customize 'config/initializers/organizations.rb'."
  say "  3. Add 'has_organizations' to your User model."
  say "  4. Mount the engine in your routes: mount Organizations::Engine => '/'"
  say "  5. Run 'rails g organizations:views' to copy the reference views"
  say "     (the engine renders HOST views — without them you'll hit"
  say "     missing-template errors on the org/membership/invitation pages)."
end