Sha256: f3715e7993f45c58cf4ace347419aa2a5876ce892131766438663b7bb43cf49f

Contents?: true

Size: 635 Bytes

Versions: 5

Compression:

Stored size: 635 Bytes

Contents

# encoding: utf-8

module MongoMapper
  module Generators
    class ModelGenerator < Rails::Generators::NamedBase
      desc 'Creates a mongomapper model'
      argument :name, :type => :string
      argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
      class_option :timestamps, :type => :boolean
      check_class_collision

      def self.source_root
        @source_root ||= File.expand_path("../templates", __FILE__)
      end

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

      hook_for :test_framework
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mongo_mapper-0.10.1 lib/rails/generators/mongo_mapper/model/model_generator.rb
mongo_mapper-0.10.0 lib/rails/generators/mongo_mapper/model/model_generator.rb
mongo_mapper-0.9.2 lib/rails/generators/mongo_mapper/model/model_generator.rb
mongo_mapper-0.9.1 lib/rails/generators/mongo_mapper/model/model_generator.rb
mongo_mapper-0.9.0 lib/rails/generators/mongo_mapper/model/model_generator.rb