Class: Trek::Generators::Install::MenuNodeGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Trek::Generators::Install::MenuNodeGenerator
- Includes:
- Rails::Generators::Migration, Helpers
- Defined in:
- lib/generators/trek/install/menu_node_generator.rb
Instance Method Summary collapse
- #copy_menu_node_hierarchies_migration_file ⇒ Object
- #copy_migration_file ⇒ Object
- #copy_model ⇒ Object
Instance Method Details
#copy_menu_node_hierarchies_migration_file ⇒ Object
29 30 31 32 |
# File 'lib/generators/trek/install/menu_node_generator.rb', line 29 def rails_command "db:migrate" # `menu_nodes` table must exist generate "closure_tree:migration MenuNode" end |
#copy_migration_file ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/generators/trek/install/menu_node_generator.rb', line 21 def copy_migration_file return unless defined?(ActiveRecord) migration_template("migrations/menu_nodes.rb.erb", "db/migrate/trek_menu_nodes.rb", migration_class_name:) end |
#copy_model ⇒ Object
16 17 18 19 |
# File 'lib/generators/trek/install/menu_node_generator.rb', line 16 def copy_model template "models/menu_node.rb", "app/models/menu_node.rb" end |