Sha256: 436da0eea2efed55094a05c1e11518aa12a42b59f33ac2a004cc3c27538cd5cd
Contents?: true
Size: 1003 Bytes
Versions: 11
Compression:
Stored size: 1003 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" check_class_collision class_option :timestamps, :type => :boolean class_option :parent, :type => :string, :desc => "The parent class for the generated model" def self.source_root @source_root ||= File.expand_path("../templates", __FILE__) end def create_model_file template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb") end hook_for :test_framework protected def parent_class_name options[:parent] end # Rails 3.0.X compatibility unless methods.include?(:module_namespacing) def module_namespacing(&block) yield if block end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems