Sha256: 142f853548de70db70c96df4f9b27152802bedd8d46595f1d6b6e55c566aec65

Contents?: true

Size: 780 Bytes

Versions: 36

Compression:

Stored size: 780 Bytes

Contents

require 'rails/generators/base'

module MongoModel
  module Generators
    class ModelGenerator < Rails::Generators::NamedBase
      source_root File.expand_path('../templates', __FILE__)

      argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
      
      class_option :timestamps, :type => :boolean, :aliases => "-T", :default => true,  :desc => "Add timestamp fields (created_at, updated_at)"
      class_option :embedded,   :type => :boolean, :aliases => "-E", :default => false, :desc => "Inherit from EmbeddedDocument"

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

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
mongomodel-0.5.5 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.5.4 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.5.3 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.5.2 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.5.1 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.5.0 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.4.9 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.4.8 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.4.7 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.4.6 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.4.5 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.4.4 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.4.3 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.4.2 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.4.1 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.4.0 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.3.6 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.3.5 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.3.4 lib/rails/generators/mongo_model/model/model_generator.rb
mongomodel-0.3.3 lib/rails/generators/mongo_model/model/model_generator.rb