Sha256: 8a0408f4cbe311bc60822717693858cd5ed72123bd2cdd3cb22470e03b7e82b0

Contents?: true

Size: 703 Bytes

Versions: 19

Compression:

Stored size: 703 Bytes

Contents

<% module_namespacing do -%>
class <%= class_name %><%= " < #{options[:parent].classify}" if options[:parent] %>
<% unless options[:parent] -%>
  include Mongoid::Document
<% end -%>
<% if options[:timestamps] -%>
  include Mongoid::Timestamps
<% end -%>
<% if options[:collection] -%>
  store_in collection: "<%= options[:collection] %>"
<% end -%>
<% attributes.reject{|attr| attr.reference?}.each do |attribute| -%>
  field :<%= attribute.name %>, type: <%= attribute.type_class %><% if attribute.default -%>, default: '<%= attribute.default %>'<% end -%>

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

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
cqm-models-4.2.0 lib/generators/custom_mongo/model.rb.tt
cqm-models-3.1.2 lib/generators/custom_mongo/model.rb.tt
cqm-models-4.1.1 lib/generators/custom_mongo/model.rb.tt
cqm-models-4.1.0 lib/generators/custom_mongo/model.rb.tt
cqm-models-4.0.2 lib/generators/custom_mongo/model.rb.tt
cqm-models-4.0.1 lib/generators/custom_mongo/model.rb.tt
cqm-models-4.0.0 lib/generators/custom_mongo/model.rb.tt
cqm-models-3.1.1 lib/generators/custom_mongo/model.rb.tt
cqm-models-3.1.0 lib/generators/custom_mongo/model.rb.tt
cqm-models-3.0.6 lib/generators/custom_mongo/model.rb.tt
cqm-models-3.0.5 lib/generators/custom_mongo/model.rb.tt
cqm-models-3.0.4 lib/generators/custom_mongo/model.rb.tt
cqm-models-3.0.3 lib/generators/custom_mongo/model.rb.tt
cqm-models-3.0.2 lib/generators/custom_mongo/model.rb.tt
cqm-models-3.0.1 lib/generators/custom_mongo/model.rb.tt
cqm-models-2.0.1 lib/generators/custom_mongo/model.rb.tt
cqm-models-3.0.0 lib/generators/custom_mongo/model.rb.tt
cqm-models-2.0.0 lib/generators/custom_mongo/model.rb.tt
cqm-models-1.1.1.0 lib/generators/custom_mongo/model.rb.tt