Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoid-erd

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoid-erd

  • 0.0.8
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= Mongoid-ERD

Create model-diagram (ERD graph) via Graphviz using the mongoid's model source code.

Export a executable merd:

$ merd | dot -Tpng > docs/erd.png

or:

$ merd --model_dir=other/models | dot -Tpng > docs/erd.png

You can also create only a subset of models by:

$ merd --include=Class1,Class2

or

$ merd --exclude=Class4,Class5

You need to add dot executable in your PATH.

= Class, Inherits and Fields

  • class xxx:yyy: a record xxx inherit from yyy. The first class that contains include Mongoid::Document on the file will be tracked. yyy will be created as a box node if no corresponding file found.

  • field :xxx, type:yyy: a field xxx with type yyy. type and default will be tracked.

  • embeds_many/embeds_one/has_many/has_one :xxx, :as => :yyy: field and a belong_to/embeds_many/embeds_one/has_one link to xxx

  • belongs_to/embedded_in :xxx: a field without link.

Methods before :private keyword will also be tracked.

= Special Markers

erd_tag user.core tag name of the current class (see configuration files below)

erd{}

class xxx:yyy # erd{fillcolor:xxx} yyy: yyy will become the label of the current class.

field ... # erd{...} xxx: xxx will become the label of that field.

embeds_many ... # erd{...} yyy: yyy will become the label of that edge.

erd -> node_name{color:yyy} label: arbitrage edge with attributes.

= Configuration Files

config/mongoid_erd.yml:

user: {shape: Mrecord}
user.core: {fillcolor: blue}

user.core attributes will be merged to user, then should be merged into class ... # erd{attrs}. Those attributes will passed to dot language as the attributes associate to the class node.

An other will to use tag is restrict output contains only classes with specific tag:

$ merd --tag=user

FAQs

Package last updated on 13 Mar 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc