Sha256: ca91b45f40eab6e9bbe1023b4cdc69943513ce2563deda3595553c65a6db709c

Contents?: true

Size: 613 Bytes

Versions: 2

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

require 'generators/aws_record/base'

module AwsRecord
  module Generators
    class ModelGenerator < Base
      def initialize(args, *options)
        self.class.source_root File.expand_path('templates', __dir__)
        super
      end

      def create_model
        template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
      end

      def create_table_config
        return unless options['table_config']

        template 'table_config.rb',
                 File.join('db/table_config', class_path, "#{file_name}_config.rb")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aws-record-rails-0.2.0 lib/generators/aws_record/model/model_generator.rb
aws-record-rails-0.1.0 lib/generators/aws_record/model/model_generator.rb