<% module_namespacing do -%> class <%= class_name %><%= “ < #{options.classify}” if options %> <% unless options -%>

include Mongoid::Document

<% end -%> <% if options -%>

include Mongoid::Timestamps

<% end -%> <% if options -%>

store_in collection: "<%= options[:collection] %>"

<% end -%> <% attributes.reject{|attr| attr.reference?}.each do |attribute| -%>

field :<%= attribute.name %>, type: <%= attribute.type_class %>

<% end -%> <% attributes.select{|attr| attr.reference? }.each do |attribute| -%>

belongs_to :<%= attribute.name%>

<% end -%> end <% end -%>