Sha256: 27af2f4a232d8281aa8e6ca988caedb4a2a6502efeb224b941245a08b0cb633d

Contents?: true

Size: 1.69 KB

Versions: 2

Compression:

Stored size: 1.69 KB

Contents

# -*- encoding : utf-8 -*-
MDWA::DSL.entities.register "<%= name.singularize.camelize %>" do |e|
  
  <%- if options.user -%>
  # NOTE: Users have the following attributes predefined (Devise defaults):
  # "email", "password", "password_confirmation", "encrypted_password", "name", "type", "reset_password_token", 
  # "reset_password_sent_at", "remember_created_at", "sign_in_count", "current_sign_in_at", "last_sign_in_at", 
  # "current_sign_in_ip", "last_sign_in_ip", "created_at", "updated_at"
  e.user        = true
  <%- end -%>
  
  <%- unless options.no_comments -%>
  # e.purpose   = %q{To-do} # what this entity does?
  # e.resource  = true      # should it be stored like a resource?
  # e.ajax      = true      # scaffold with ajax?
  # e.user      = false     # is this entity a loggable user?
  # e.scaffold_name = 'a/<%= name.singularize.underscore %>' # mdwa sandbox specific code?
  # e.model_name = 'a/<%= name.singularize.underscore %>' # use specific model name? or different namespace?

  ##
  ## Define entity attributes
  ##
  # e.attribute do |attr|
  #   attr.name = 'name'
  #   attr.type = 'string'
  # end
  # e.attribute do |attr|
  #   attr.name = 'category'
  #   attr.type = 'integer'
  # end
  
  ##
  ## Define entity associations
  ##
  # e.association do |a|
  #   a.type = 'many_to_one'
  #   a.destination = 'Category' # entity name
  #   a.description = '<%= name.singularize.humanize %> belongs to category'
  # end
  # 
  # e.association do |a|
  #   a.name = 'address' # specify a name for the associations
  #   a.type = 'one_to_one'
  #   a.destination = 'Address' 
  #   a.composition = true
  #   a.description = 'This entity has a composite address.'
  # end
  <%- end -%>
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mdd-3.0.2 lib/generators/mdwa/entity/templates/entity.rb
mdd-3.0.1 lib/generators/mdwa/entity/templates/entity.rb