Sha256: 58c88ecc28f75190bb28164684ee6a830c81b881857fd4938f4c4764f89a7b4e

Contents?: true

Size: 703 Bytes

Versions: 15

Compression:

Stored size: 703 Bytes

Contents

Merb::Generators::ModelGenerator.option :migration, :as => :boolean, :desc => 'Also generate a dm-migration for the model'

class Merb::Generators::ModelGenerator
  ##
  # Corrects case of common datamapper arguments.
  def datamapper_type(type)
    return 'DateTime' if type == 'datetime'
    return type.camel_case
  end
  
  def after_generation
     STDOUT << message("Don't forget to define the model schema in your #{file_name.capitalize} class")
  end
  
end

Merb::Generators::ModelGenerator.template :model_datamapper, :orm => :datamapper do |t|
  t.source = File.join(File.dirname(__FILE__), "templates", "model.rb")
  t.destination = File.join("app/models", base_path, "#{file_name}.rb")
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
merb_datamapper-0.9.9 lib/generators/data_mapper_model.rb
merb_datamapper-0.9.10 lib/generators/data_mapper_model.rb
merb_datamapper-0.9.11 lib/generators/data_mapper_model.rb
merb_datamapper-0.9.12 lib/generators/data_mapper_model.rb
merb_datamapper-0.9.13 lib/generators/data_mapper_model.rb
merb_datamapper-1.0 lib/generators/data_mapper_model.rb
merb_datamapper-1.0.1 lib/generators/data_mapper_model.rb
merb_datamapper-1.0.2 lib/generators/data_mapper_model.rb
merb_datamapper-1.0.3 lib/generators/data_mapper_model.rb
merb_datamapper-1.0.4 lib/generators/data_mapper_model.rb
merb_datamapper-1.0.5 lib/generators/data_mapper_model.rb
merb_datamapper-1.0.6 lib/generators/data_mapper_model.rb
merb_datamapper-1.0.6.1 lib/generators/data_mapper_model.rb
merb_datamapper-1.0.7 lib/generators/data_mapper_model.rb
merb_datamapper-1.0.7.1 lib/generators/data_mapper_model.rb