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