Sha256: 9cf42ef440bf44b96b67990d279cee8d9942ff44849917bd1adc4a406d8be49b

Contents?: true

Size: 588 Bytes

Versions: 2

Compression:

Stored size: 588 Bytes

Contents

module Ashikawa
  module Generators
    # Generates a Model using Ashikawa::AR for Rails
    class ModelGenerator < Rails::Generators::NamedBase
      source_root File.expand_path('../templates', __FILE__)

      desc "Creates an Ashikawa::AR model"
      argument :attributes,
        type: :array,
        default: [],
        banner: "attribute[:type] attribute[:type]"

      check_class_collision

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

      hook_for :test_framework
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ashikawa-ar-0.1.3 lib/rails/generators/ashikawa/model_generator.rb
ashikawa-ar-0.1.2 lib/rails/generators/ashikawa/model_generator.rb