Class: WebflowSync::Generators::CollectionGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- WebflowSync::Generators::CollectionGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/webflow_sync/collection_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
27 28 29 |
# File 'lib/generators/webflow_sync/collection_generator.rb', line 27 def self.next_migration_number(dirname) ActiveRecord::Generators::Base.next_migration_number(dirname) end |
Instance Method Details
#add_migration ⇒ Object
13 14 15 16 |
# File 'lib/generators/webflow_sync/collection_generator.rb', line 13 def add_migration migration_template 'migration.rb.erb', "#{migration_path}/add_webflow_item_id_to_#{table_name}.rb", migration_version: end |
#include_item_sync_in_model_file ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/generators/webflow_sync/collection_generator.rb', line 18 def include_item_sync_in_model_file module_snippet = <<~END_OF_INCLUDE.indent(2) include WebflowSync::ItemSync END_OF_INCLUDE insert_into_file "app/models/#{name.underscore}.rb", module_snippet, after: / < ApplicationRecord$/ end |