Class: Mistri::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Mistri::Generators::InstallGenerator
- Includes:
- ActiveRecord::Generators::Migration
- Defined in:
- lib/generators/mistri/install/install_generator.rb
Overview
bin/rails generate mistri:install AgentEntry
Creates the session-entry model, named by the host application, and its migration, ready for Mistri::Stores::ActiveRecord.
Instance Method Summary collapse
Instance Method Details
#create_migration_file ⇒ Object
24 25 26 27 |
# File 'lib/generators/mistri/install/install_generator.rb', line 24 def create_migration_file migration_template "migration.rb.tt", File.join(db_migrate_path, "create_#{table_name}.rb") end |
#create_model ⇒ Object
20 21 22 |
# File 'lib/generators/mistri/install/install_generator.rb', line 20 def create_model template "model.rb.tt", File.join("app/models", class_path, "#{file_name}.rb") end |
#show_wiring ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/generators/mistri/install/install_generator.rb', line 29 def show_wiring say <<~NOTE Wire the store with your model: store = Mistri::Stores::ActiveRecord.new(#{class_name}) session = Mistri::Session.new(store: store) (require "mistri/stores/active_record" where you build it.) NOTE end |