Sha256: bf053936e2b0a7efd7b97df2918bc519dcd339ee5ff6ab9335039784e4d518f6
Contents?: true
Size: 887 Bytes
Versions: 2
Compression:
Stored size: 887 Bytes
Contents
module WebammToRails module Sources module Migrations class ActiveStorageDefinition class Presenter def initialize(waml_definition:) @waml_definition = waml_definition end def file_name(migration_timestamp) "db/migrate/#{migration_timestamp}_create_active_storage_tables.rb" end def render template_path = File.expand_path('template.erb', __dir__) template_content = File.read(template_path) raw_content = ERB.new(template_content, trim_mode: '-').result(instance_eval { binding }) ::WebammToRails::Utils::FormatCode.call(raw_content) end def render? @waml_definition.database.schema.any? { |table| table.columns.any? { |column| column.type == 'file' } } end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems