Sha256: 1ec2a9b4e30037dc031c3d2195074cf96b09a32c50d90b645e8d0c0b225dfdf4

Contents?: true

Size: 740 Bytes

Versions: 4

Compression:

Stored size: 740 Bytes

Contents

# -*- encoding : utf-8 -*-

require 'rails/generators/guacamole_generator'

module Guacamole
  module Generators
    class ModelGenerator < Base
      desc 'Creates a Guacamole model'
      argument :attributes, type: :array, default: [], banner: 'field:type field:type'

      check_class_collision

      class_option :parent, type: :string, desc: 'The parent class for the generated model'

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

      hook_for :test_framework
      hook_for :collection, aliases: '-c', type: :boolean, default: true do |instance, collection|
        instance.invoke collection, [instance.name.pluralize]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
guacamole-0.4.0 lib/rails/generators/guacamole/model/model_generator.rb
guacamole-0.3.0 lib/rails/generators/guacamole/model/model_generator.rb
guacamole-0.2.0 lib/rails/generators/guacamole/model/model_generator.rb
guacamole-0.1.0 lib/rails/generators/guacamole/model/model_generator.rb