Sha256: 730ed6869528464115aacf102219a4bb8f013a665cd8db3cd0dc98fb567068b3

Contents?: true

Size: 1.04 KB

Versions: 15

Compression:

Stored size: 1.04 KB

Contents

class <%= class_name %><%= "< #{options[:parent].classify}" if parent? %>
<% unless parent? -%>
  include MongoMapper::Document         
<% end -%>
<%= statements %>
<% unless parent? -%>
# Validations :::::::::::::::::::::::::::::::::::::::::::::::::::::
# validates_presence_of :attribute

# Assocations :::::::::::::::::::::::::::::::::::::::::::::::::::::
# belongs_to :model
# many :model
# one :model

# Callbacks ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
# before_create :your_model_method
# after_create :your_model_method
# before_update :your_model_method 

# Attribute options extras ::::::::::::::::::::::::::::::::::::::::
# attr_accessible :first_name, :last_name, :email

# Validations
# key :name, :required =>  true      

# Defaults
# key :done, :default => false

# Typecast
# key :user_ids, Array, :typecast => 'ObjectId'
  
<% end -%>   
<% model_attributes.each_with_index do |attribute, i| -%>
  key :<%= attribute.name %>, <%= attribute.type_class %><%= ", :index => true" if model_indexes[attribute.name] %>
<% end -%>
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rails3-generators-0.17.6 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.17.5 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.17.4 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.17.3 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.17.2 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.17.1 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.17.0 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.16.1 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.16.0 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.15.0 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.14.0 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.13.0 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.12.1 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.12.0 lib/generators/mongo_mapper/model/templates/model.rb
rails3-generators-0.11.0 lib/generators/mongo_mapper/model/templates/model.rb