Coder Social home page Coder Social logo

rails-erd's People

Contributors

a2ikm avatar amatsuda avatar ar3 avatar awebneck avatar bf4 avatar burisu avatar cherimarie avatar chughes87 avatar ckib16 avatar cobbr2 avatar codegoalie avatar creativeuser avatar cristianstanescu avatar d-ray avatar danielevans avatar davejm avatar durandom avatar fschwahn avatar inclooder avatar inkybro avatar kerrizor avatar kikunantoka avatar magneland avatar matugm avatar raphaelpra avatar rolftimmermans avatar scarroll32 avatar sebroeder avatar sferik avatar wurma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rails-erd's Issues

Error in Mavericks: "only use PostScript names"

brew info graphviz
graphviz: stable 2.34.0, devel 2.35.20130914.0446
...

Errors are shown one by one on this order:

Saving diagram failed!
Graphviz produced errors. Verify it has support for filetype=pdf, or use filetype=dot.
Original error: 2013-10-30 00:54:38.917 dot[42907:d07] CoreText performance note: Client called CTFontCreateWithName() using name "Arial Italic" and got font with PostScript name "Arial-ItalicMT". For best performance, only use PostScript names when calling this API.
...
Saving diagram failed!
Graphviz produced errors. Verify it has support for filetype=pdf, or use filetype=dot.
Original error: 2013-10-30 00:56:52.537 dot[43000:d07] CoreText performance note: Client called CTFontCreateWithName() using name "Arial" and got font with PostScript name "ArialMT". For best performance, only use PostScript names when calling this API.
...
Saving diagram failed!
Graphviz produced errors. Verify it has support for filetype=pdf, or use filetype=dot.
Original error: 2013-10-30 00:57:12.159 dot[43036:d07] CoreText performance note: Client called CTFontCreateWithName() using name "Arial Bold" and got font with PostScript name "Arial-BoldMT". For best performance, only use PostScript names when calling this API.

Replacing the font names with the PostScript names solves the issue. I'm not sure if this is backwards compatible, so I'm not pushing my code. I will, gladly, once this is discussed.

Got an undefined method error

Platform:
OS: Mac OS X
Ruby: 1.9.3
Rails: 3.0.5
Graphviz: 2.30.1

Got error:
undefined methodisolate_namespace' for Erd::Engine:Class`

Orientation needs a square option.

I have a Rails app with some 150 or so activerecord models. Neither vertical or horizontal orientation work well since there will be so much overlap between different lines since the output will either be absurdly long or absurdly high.

I believe a square option would work a lot better.

Subset possible?

It is possible to get rails-erd to create a subset of an application's models? On very large projects, the output of erd-rails can be almost unintelligible due to "cables" where many relationships visually merge together and cross-cross all over the diagram.

For example, it would be nice to say something like "rake erd MODELS=foo,bar,baz" and have the tool only build an ERD for those three models. I don't know how difficult this is, but it's a feature I really wish I'd had today. :)

rails-erd does not recognize models from engine correctly

When you mount an engine that contains models, the models are not recognized and an error is thrown.

In my case, we created a rails 3.1 mountable plugin called nms-cmdb and we are getting the following error output when running the 'rake erd' command:

$ rake erd --trace
** Invoke erd (first_time)
** Invoke erd:generate (first_time)
** Invoke erd:options (first_time)
** Execute erd:options
** Invoke erd:load_models (first_time)
** Execute erd:load_models
Loading application environment...
** Invoke environment (first_time)
** Execute environment
Loading code in search of Active Record models...
rake aborted!
wrong constant name Nms-cmdb
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:378:in const_defined?' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:378:inlocal_const_defined?'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:365:in block in qualified_const_defined?' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:364:ineach'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:364:in inject' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:364:inqualified_const_defined?'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:125:in block in watch_namespaces' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:123:inmap'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:123:in watch_namespaces' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:636:innew_constants_in'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:455:in load_file' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:342:inrequire_or_load'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:302:in depend_on' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:214:inrequire_dependency'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/engine.rb:416:in block (2 levels) in eager_load!' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/engine.rb:415:ineach'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/engine.rb:415:in block in eager_load!' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/engine.rb:413:ineach'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/engine.rb:413:in eager_load!' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/application/railties.rb:8:ineach'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/application/railties.rb:8:in all' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/engine.rb:411:ineager_load!'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/tasks.rake:23:in block (2 levels) in <top (required)>' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:incall'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in block in execute' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:ineach'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in execute' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:158:inblock in invoke_with_call_chain'
/usr/local/ruby1.9.2_railspre/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:ininvoke_with_call_chain'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:176:in block in invoke_prerequisites' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:ineach'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:in invoke_prerequisites' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:157:inblock in invoke_with_call_chain'
/usr/local/ruby1.9.2_railspre/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:ininvoke_with_call_chain'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:176:in block in invoke_prerequisites' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:ineach'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:in invoke_prerequisites' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:157:inblock in invoke_with_call_chain'
/usr/local/ruby1.9.2_railspre/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:ininvoke_with_call_chain'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:144:in invoke' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:112:ininvoke_task'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in block (2 levels) in top_level' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:ineach'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in block in top_level' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:instandard_exception_handling'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:84:in top_level' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:62:inblock in run'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in standard_exception_handling' /usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:inrun'
/usr/local/ruby1.9.2_railspre/lib/ruby/gems/1.9.1/gems/rake-0.9.2/bin/rake:32:in <top (required)>' /usr/local/ruby1.9.2_railspre/bin/rake:19:inload'
/usr/local/ruby1.9.2_railspre/bin/rake:19:in `

'
Tasks: TOP => erd => erd:generate => erd:load_models

On Mac OSX Lion, install commands fail, rake erd fails, and making a .dot has no diagrams

Install fails:

$ brew install cairo pango graphviz 
==> Downloading http://www.cairographics.org/releases/cairo-1.10.2.tar.gz
File already downloaded in /Users/daze/Library/Caches/Homebrew
==> ./configure --disable-dependency-tracking --prefix=/usr/local/Cellar/cairo/1.10.2 --with-x
==> make install
==> Caveats
This formula is keg-only, so it was not symlinked into /usr/local.

Mac OS X already provides this program and installing another version in
parallel can cause all kinds of trouble.

The Cairo provided by Leopard is too old for newer software to link against.

Generally there are no consequences of this for you.
If you build your own software and it requires this formula, you'll need
to add its lib & include paths to your build variables:

  LDFLAGS: -L/usr/local/Cellar/cairo/1.10.2/lib
  CPPFLAGS: -I/usr/local/Cellar/cairo/1.10.2/include
==> Summary
/usr/local/Cellar/cairo/1.10.2: 91 files, 6.4M, built in 55 seconds
Also installing dependencies: glib
==> Downloading ftp://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.7.tar.bz2
File already downloaded in /Users/daze/Library/Caches/Homebrew
==> Downloading patches

curl: (22) The requested URL returned error: 404
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
######################################################################## 100.0%
==> Patching
/usr/bin/patch: **** Can't open patch file 001-homebrew.diff : No such file or directory
Error: Failure while executing: /usr/bin/patch -f -p0 -i 001-homebrew.diff

rake erd doesn't work either:


$ rake erd --trace
(in /Users/daze/Documents/Workspace/Rails/vds-pip)
** Invoke erd (first_time)
** Invoke erd:generate (first_time)
** Invoke erd:options (first_time)
** Execute erd:options
** Invoke erd:load_models (first_time)
** Execute erd:load_models
Loading application environment...
** Invoke environment (first_time)
** Execute environment
Loading code in search of Active Record models...
** Execute erd:generate
Generating Entity-Relationship Diagram for 10 models...
rake aborted!
Saving diagram failed!
Verify that Graphviz is installed and in your path, or use filetype=dot.
/Users/daze/.rvm/gems/ruby-1.8.7-p334@vds-pip/gems/rails-erd-0.4.5/lib/rails_erd/diagram/graphviz.rb:176
/Users/daze/.rvm/gems/ruby-1.8.7-p334@vds-pip/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:142:in `instance_eval'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@vds-pip/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:142:in `save'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@vds-pip/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:120:in `create'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@vds-pip/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:74:in `create'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@vds-pip/gems/rails-erd-0.4.5/lib/rails_erd/tasks.rake:41
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/Users/daze/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/Users/daze/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/gems/rake-0.8.7/bin/rake:31
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/bin/rake:19:in `load'
/Users/daze/.rvm/gems/ruby-1.8.7-p334@global/bin/rake:19

Lastly, using filetype=dot creates a .dot file, but there are no diagrams inside - just a bunch of confusing text and not helpful text.

ERD for latest Spree edge code only contains a few models.

I used rails erd to try to generate ERD for the latest Spree edge code:

$ rake erd
Loading Active Record models...
Generating Entity-Relationship Diagram...
Warning: Ignoring invalid model MailMethod (table mail_methods does not exist)
Warning: Ignoring invalid association :inventory_units on Order (model InventoryUnit exists, but is not included in domain)
Warning: Ignoring invalid association :payments on Order (model Payment exists, but is not included in domain)
Warning: Ignoring invalid association :ship_address on Order (model Address exists, but is not included in domain)
Warning: Ignoring invalid association :vendor on Order (model Vendor exists, but is not included in domain)
Warning: Ignoring invalid association :shipping_method on Order (model ShippingMethod exists, but is not included in domain)
Warning: Ignoring invalid association :adjustments on Order (model Adjustment exists, but is not included in domain)
Warning: Ignoring invalid association :state_events on Order (model StateEvent exists, but is not included in domain)
Warning: Ignoring invalid association :bill_address on Order (model Address exists, but is not included in domain)
Warning: Ignoring invalid association :return_authorizations on Order (model ReturnAuthorization exists, but is not included in domain)
Warning: Ignoring invalid association :shipments on Order (model Shipment exists, but is not included in domain)
Warning: Ignoring invalid association :promotion_credits on Order (model PromotionCredit exists, but is not included in domain)
Warning: Ignoring invalid association :roles on User (model Role exists, but is not included in domain)
Warning: Ignoring invalid association :ship_address on User (model Address exists, but is not included in domain)
Warning: Ignoring invalid association :bill_address on User (model Address exists, but is not included in domain)
Warning: Ignoring invalid association :promotion_rules on Product (model PromotionRule exists, but is not included in domain)
Warning: Ignoring invalid association :vendor on Product (model Vendor exists, but is not included in domain)
Warning: Ignoring invalid association :option_types on Product (model OptionType exists, but is not included in domain)
Warning: Ignoring invalid association :properties on Product (model Property exists, but is not included in domain)
Warning: Ignoring invalid association :product_option_types on Product (model ProductOptionType exists, but is not included in domain)
Warning: Ignoring invalid association :tax_category on Product (model TaxCategory exists, but is not included in domain)
Warning: Ignoring invalid association :taxons on Product (model Taxon exists, but is not included in domain)
Warning: Ignoring invalid association :product_properties on Product (model ProductProperty exists, but is not included in domain)
Warning: Ignoring invalid association :shipping_category on Product (model ShippingCategory exists, but is not included in domain)
Warning: Ignoring invalid association :images on Product (model Image exists, but is not included in domain)
Warning: Ignoring invalid association :inventory_units on Variant (model InventoryUnit exists, but is not included in domain)
Warning: Ignoring invalid association :option_values on Variant (model OptionValue exists, but is not included in domain)
Warning: Ignoring invalid association :images on Variant (model Image exists, but is not included in domain)
Warning: Ignoring invalid association :promotion_rules on ProductGroup (model PromotionRule exists, but is not included in domain)
Warning: Ignoring invalid association :product_scopes on ProductGroup (model ProductScope exists, but is not included in domain)

The generated diagram only contains a few models, namely: ProductGroup, Product, Variant, User, Order, LineItem

ruby-json dependence

Hi, the "rake erd" task returned the following message to me:

rake aborted!
No such file to load -- json/objects

So i resolved the problem with:

Gemfile
gem "ruby-json"

$ bundle install

Need this to be added to installation documentation?

Thanks.

How to fix? ( undefined method name' for nil:NilClass )

rake erd --trace
** Invoke erd (first_time)
** Invoke erd:generate (first_time)
** Invoke erd:options (first_time)
** Execute erd:options
** Invoke erd:load_models (first_time)
** Execute erd:load_models
Loading application environment...
** Invoke environment (first_time)
** Execute environment
Loading code in search of Active Record models...
** Execute erd:generate
Generating Entity-Relationship Diagram for 35 models...
Warning: Ignoring invalid model WiceGridSerializedQuery (table wice_grid_serialized_queries does not exist)
Warning: Ignoring invalid model Old::OldCategory (Unknown database 'snegiri_legacy')
Warning: Ignoring invalid model Old::OldField (Unknown database 'snegiri_legacy')
Warning: Ignoring invalid association :resource on ActiveAdmin::Comment (polymorphic interface Resource does not exist)
Warning: Ignoring invalid association :author on ActiveAdmin::Comment (polymorphic interface Author does not exist)
Warning: Ignoring invalid association :admins on City (uninitialized constant City::Admin)
Warning: Ignoring invalid association :assetable on Ckeditor::Asset (polymorphic interface Assetable does not exist)
Warning: Ignoring invalid association :assetable on Ckeditor::Asset (polymorphic interface Assetable does not exist)
Warning: Ignoring invalid association :assetable on Ckeditor::Asset (polymorphic interface Assetable does not exist)
rake aborted!
undefined method name' for nil:NilClass /home/zheka/.rvm/gems/ruby-2.0.0-p0@snegiri/bundler/gems/rails-erd-d29b0c29fcfa/lib/rails_erd/domain/specialization.rb:66:in<=>'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@snegiri/bundler/gems/rails-erd-d29b0c29fcfa/lib/rails_erd/domain/specialization.rb:13:in sort' /home/zheka/.rvm/gems/ruby-2.0.0-p0@snegiri/bundler/gems/rails-erd-d29b0c29fcfa/lib/rails_erd/domain/specialization.rb:13:infrom_models'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@snegiri/bundler/gems/rails-erd-d29b0c29fcfa/lib/rails_erd/domain.rb:67:in specializations' /home/zheka/.rvm/gems/ruby-2.0.0-p0@snegiri/bundler/gems/rails-erd-d29b0c29fcfa/lib/rails_erd/diagram.rb:170:infiltered_specializations'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@snegiri/bundler/gems/rails-erd-d29b0c29fcfa/lib/rails_erd/diagram.rb:132:in generate' /home/zheka/.rvm/gems/ruby-2.0.0-p0@snegiri/bundler/gems/rails-erd-d29b0c29fcfa/lib/rails_erd/diagram.rb:119:increate'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@snegiri/bundler/gems/rails-erd-d29b0c29fcfa/lib/rails_erd/diagram.rb:74:in create' /home/zheka/.rvm/gems/ruby-2.0.0-p0@snegiri/bundler/gems/rails-erd-d29b0c29fcfa/lib/rails_erd/tasks.rake:41:inblock (2 levels) in <top (required)>'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:246:in call' /home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:246:inblock in execute'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:241:in each' /home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:241:inexecute'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:184:in block in invoke_with_call_chain' /home/zheka/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/monitor.rb:211:inmon_synchronize'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:177:in invoke_with_call_chain' /home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:205:inblock in invoke_prerequisites'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:203:in each' /home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:203:ininvoke_prerequisites'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:183:in block in invoke_with_call_chain' /home/zheka/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/monitor.rb:211:inmon_synchronize'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:177:in invoke_with_call_chain' /home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/task.rb:170:ininvoke'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:143:in invoke_task' /home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:101:inblock (2 levels) in top_level'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:101:in each' /home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:101:inblock in top_level'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:110:in run_with_threads' /home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:95:intop_level'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:73:in block in run' /home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:160:instandard_exception_handling'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/lib/rake/application.rb:70:in run' /home/zheka/.rvm/gems/ruby-2.0.0-p0@global/gems/rake-10.0.4/bin/rake:33:in<top (required)>'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@global/bin/rake:23:in load' /home/zheka/.rvm/gems/ruby-2.0.0-p0@global/bin/rake:23:in

'
/home/zheka/.rvm/gems/ruby-2.0.0-p0@snegiri/bin/ruby_noexec_wrapper:14:in eval' /home/zheka/.rvm/gems/ruby-2.0.0-p0@snegiri/bin/ruby_noexec_wrapper:14:in'
Tasks: TOP => erd => erd:generate

Saving diagram failed.

On a Mac. Using (installed via Homebrew):
graphviz 2.26.3
pango 1.28.3
cairo 1.8.10

Running rake erd --trace, I get the following error. Happens with filetype=dot too:

** Invoke erd (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute erd
rake aborted!
Saving diagram failed. Verify that Graphviz is installed or select filetype=dot.
/Library/Ruby/Gems/1.8/gems/rails-erd-0.4.3/lib/rails_erd/diagram/graphviz.rb:173
/Library/Ruby/Gems/1.8/gems/rails-erd-0.4.3/lib/rails_erd/diagram.rb:142:in `instance_eval'
/Library/Ruby/Gems/1.8/gems/rails-erd-0.4.3/lib/rails_erd/diagram.rb:142:in `save'
/Library/Ruby/Gems/1.8/gems/rails-erd-0.4.3/lib/rails_erd/diagram.rb:120:in `create'
/Library/Ruby/Gems/1.8/gems/rails-erd-0.4.3/lib/rails_erd/diagram.rb:74:in `create'
./tasks/misc.rake:18
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19

Original error: cairo: out of memory

I had the problem described in #12, so I did

$ brew uninstall cairo pango graphviz
$ brew install cairo pango graphviz
$ rake erd
Loading application environment...
Loading code in search of Active Record models...
Generating Entity-Relationship Diagram for 12 models...
rake aborted!
Saving diagram failed!
Graphviz produced errors. Verify it has support for filetype=pdf, or use filetype=dot.
Original error: cairo: out of memory

Tasks: TOP => erd => erd:generate
(See full trace by running task with --trace)

When installing both cairo and libiconv I got similar messages:

This formula is keg-only, so it was not symlinked into /usr/local.

Mac OS X already provides this program and installing another version in
parallel can cause all kinds of trouble.

The Cairo provided by Leopard is too old for newer software to link against.

Generally there are no consequences of this for you.
If you build your own software and it requires this formula, you'll need
to add its lib & include paths to your build variables:

  LDFLAGS: -L/usr/local/Cellar/cairo/1.10.2/lib
  CPPFLAGS: -I/usr/local/Cellar/cairo/1.10.2/include

I'm running Mac OS X 10.7 (Lion) and I wanted to know if this might be the issue, and were could I start looking for fixes. Thanks for making this great software.

Exception creating ERD from model

Exception below. Unfortunately I cannot share the full model. But any pointers to diagnose or workarounds are appreciated. Thanks.

Version:
rails-erd (1.1.0)

$ rake erd --trace filetype=dot
** Invoke erd (first_time)
** Invoke erd:generate (first_time)
** Invoke erd:options (first_time)
** Execute erd:options
** Invoke erd:load_models (first_time)
** Execute erd:load_models
Loading application environment...
** Invoke environment (first_time)
** Execute environment
Loading code in search of Active Record models...
** Execute erd:generate
Generating Entity-Relationship Diagram for 56 models...
Warning: Ignoring invalid model MembershipsEventHandler (table memberships_event_handlers does not exist)
Warning: Ignoring invalid association :company on Customer (uninitialized constant Customer::Company)
Warning: Ignoring invalid association :resource on Role (polymorphic interface Resource does not exist)
rake aborted!
undefined method name' for nil:NilClass /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392/gems/rails-erd-1.1.0/lib/rails_erd/domain/specialization.rb:66:in<=>'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392/gems/rails-erd-1.1.0/lib/rails_erd/domain/specialization.rb:13:in sort' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392/gems/rails-erd-1.1.0/lib/rails_erd/domain/specialization.rb:13:infrom_models'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392/gems/rails-erd-1.1.0/lib/rails_erd/domain.rb:67:in specializations' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:170:infiltered_specializations'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:132:in generate' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:119:increate'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:74:in create' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392/gems/rails-erd-1.1.0/lib/rails_erd/tasks.rake:41:inblock (2 levels) in <top (required)>'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:246:in call' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:246:inblock in execute'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:241:in each' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:241:inexecute'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:184:in block in invoke_with_call_chain' /Users/vikrampillai/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/monitor.rb:211:inmon_synchronize'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:177:in invoke_with_call_chain' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:205:inblock in invoke_prerequisites'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:203:in each' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:203:ininvoke_prerequisites'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:183:in block in invoke_with_call_chain' /Users/vikrampillai/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/monitor.rb:211:inmon_synchronize'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:177:in invoke_with_call_chain' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/task.rb:170:ininvoke'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:143:in invoke_task' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:101:inblock (2 levels) in top_level'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:101:in each' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:101:inblock in top_level'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:110:in run_with_threads' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:95:intop_level'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:73:in block in run' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:160:instandard_exception_handling'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/lib/rake/application.rb:70:in run' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/gems/rake-10.0.4/bin/rake:33:in<top (required)>'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/bin/rake:19:in load' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392@global/bin/rake:19:in

'
/Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in eval' /Users/vikrampillai/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in'
Tasks: TOP => erd => erd:generate
[16:58:20] $

Dot format does not work with Omnigraffle

After running:

rake erd polymorphism=true filetype=dot

I get this error:

-[NSConcreteAttributedString rangeOfCharacterFromSet:options:range:]: unrecognized selector sent to instance 0x17415c10

Line 15: >];

Has anyone faced this problem? Any solution?

Thanks in advance!

Lucas

No entities found; I have 412 defined - using https://github.com/influitive/apartment

I have used erd in the past and has been very effective. I have just been assigned to a new app, so thought I would use ERD to orient myself. I don't know if it makes a difference, but I am using the apartment gem cited in the title.

I invoked:
rake erd orientation=vertical file_name='transcript' title='Transcript' attributes=false only='user,transcript,report_card,section_report'

And got the following error:

Loading code in search of Active Record models...
Generating Entity-Relationship Diagram for 412 models...
rake aborted!
No entities found; create your models first!
/Users/jfreeman/.rvm/gems/ruby-2.0.0-p0/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:159:in block in filtered_entities' /Users/jfreeman/.rvm/gems/ruby-2.0.0-p0/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:158:intap'
/Users/jfreeman/.rvm/gems/ruby-2.0.0-p0/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:158:in filtered_entities' /Users/jfreeman/.rvm/gems/ruby-2.0.0-p0/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:128:ingenerate'
/Users/jfreeman/.rvm/gems/ruby-2.0.0-p0/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:119:in create' /Users/jfreeman/.rvm/gems/ruby-2.0.0-p0/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:74:increate'
/Users/jfreeman/.rvm/gems/ruby-2.0.0-p0/gems/rails-erd-1.1.0/lib/rails_erd/tasks.rake:41:in block (2 levels) in <top (required)>' /Users/jfreeman/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:ineval'
/Users/jfreeman/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `

'
Tasks: TOP => erd => erd:generate
(See full trace by running task with --trace)

CamelCase and rails convention

I have a file '/ligne_commande.rb ' and erd tell me :

Expected ..../app/models/ligne_commande.rb to define Ligne_commande

Which is not the rails convention. It should expect LinegneCommande.

can't convert Symbol into String

Rails3 ruby 1.9.2
I ran rails-erd successfully on this project ~6 months ago.

 rake --trace erd filetype=dot
(in /home/gweber/proj/yap/yap-web)
.
** Invoke erd (first_time)
** Invoke erd:generate (first_time)
** Invoke erd:options (first_time)
** Execute erd:options
** Invoke erd:load_models (first_time)
** Execute erd:load_models
Loading Active Record models...
** Invoke environment (first_time)
** Execute environment
** Execute erd:generate
Generating Entity-Relationship Diagram...
rake aborted!
can't convert Symbol into String
(erb):9:in `concat'
(erb):9:in `block in entity_options'
(erb):8:in `each'
(erb):8:in `entity_options'
/home/gweber/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/erb.rb:753:in `eval'
/home/gweber/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/erb.rb:753:in `result'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rails-erd-0.3.0/lib/rails_erd/diagram/graphviz.rb:193:in `entity_options'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rails-erd-0.3.0/lib/rails_erd/diagram/graphviz.rb:149:in `process_entity'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rails-erd-0.3.0/lib/rails_erd/diagram.rb:94:in `block in generate'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rails-erd-0.3.0/lib/rails_erd/diagram.rb:93:in `each'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rails-erd-0.3.0/lib/rails_erd/diagram.rb:93:in `generate'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rails-erd-0.3.0/lib/rails_erd/diagram.rb:86:in `create'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rails-erd-0.3.0/lib/rails_erd/diagram.rb:69:in `create'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rails-erd-0.3.0/lib/rails_erd/tasks.rake:32:in `block (2 levels) in '
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/home/gweber/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:607:in `block in invoke_prerequisites'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:596:in `block in invoke_with_call_chain'
/home/gweber/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/bin/rake:31:in `'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `load'
/home/gweber/.rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `'

Undefined method name 'name' for nil :NilClass

Here is what my web page gives as an error:


NoMethodError in Users#show

Showing /home/ubuntu/rails_projects/sample_app/app/views/users/show.html.erb where line #2 raised:

undefined method `name' for nil:NilClass

Extracted source (around line #2):

1: <% provide(:title, 'User') %>
2: <%= @user.name %>

Rails.root: /home/ubuntu/rails_projects/sample_app
Application Trace | Framework Trace | Full Trace

app/views/users/show.html.erb:2:in `_app_views_users_show_html_erb__942466153__620127358'

Request

Parameters:

{"id"=>"1"}

Show session dump

Show env dump

My code is the following for the controller:

class UsersController < ApplicationController
def show
@user = User.find_by_id(params[:id])
end

def new
end

end

Here is my show.html.erb

<% provide(:title, 'User') %>
<%= @user.name %>


And i'll add that my page doesn't even get the title its supposed to.

any idea on what I should change?

Failed: NoMethodError: undefined method `each' for nil:NilClass

Steps to reproduce

Run in root rails application directory:

bundle exec erd

Backrace

/rails-erd-1.0.0/lib/rails_erd/cli.rb:130:in `start': undefined method `[]' for nil:NilClass (NoMethodError)
/rails-erd-1.0.0/lib/rails_erd/cli.rb:116:in `start'
/rails-erd-1.0.0/bin/erd:4

Environment

Rails: 3.2.6
Ruby: ruby 1.8.7, REE 2012.02
DB: PostgreSQL 9.1
ERD: RailsERD 1.0.0
OS: Linux 2.6.32-5-amd64, Debian GNU/Linux 6.0.1

in 'require': cannot load such file

I'm currently in chapter 8 of railsturorial.org and i'm running in this error and can't figure out whats wrong. Could anyone help me out?

I don't know which file to link so let me know which you would need to look at.

thanks in advance!

sudo bundle exec rspec spec/

/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in require': cannot load such file -- /home/ubuntu/rails_projects/sample_app/spec/config/environment (LoadError) from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:inblock in require'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in load_dependency' from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:inrequire'
from /home/ubuntu/rails_projects/sample_app/spec/support/spec_helper.rb:3:in <top (required)>' from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:inrequire'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in block in require' from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:inload_dependency'
from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in require' from /home/ubuntu/rails_projects/sample_app/spec/spec_helper.rb:9:inblock in <top (required)>'
from /home/ubuntu/rails_projects/sample_app/spec/spec_helper.rb:9:in each' from /home/ubuntu/rails_projects/sample_app/spec/spec_helper.rb:9:in<top (required)>'
from /home/ubuntu/rails_projects/sample_app/spec/models/user_spec.rb:1:in require' from /home/ubuntu/rails_projects/sample_app/spec/models/user_spec.rb:1:in<top (required)>'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in load' from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:inblock in load_spec_files'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in map' from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:inload_spec_files'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:22:in run' from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:inrun'
from /usr/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'

Indirect associations - the association should be symmetric

I created a sample Rails app. I generated two models, A and B, and a relationship model called Rel.
Then I added a many-to-many association between A and B using has_many :through, which connects A and B via the Rel model.
Here's some code:

# models/a.rb
class A < ActiveRecord::Base
    has_many :rels
    has_many :bs, through: :rels
end
# models/b.rb
class B < ActiveRecord::Base
    has_many :rels
    has_many :as, through: :rels
end
# db/migrate/xxx_create_rels.rb
class CreateRels < ActiveRecord::Migration
  def change
    create_table :rels do |t|
      t.belongs_to :a, index: true
      t.belongs_to :b, index: true

      t.timestamps
    end
  end
end

When using rails-erd, I expect to get a many-to-many indirect (as stated on the docs) association between A and B, which means a dotted line with arrows at both ends between A and B (as if I used HABTM), and a solid line with between A and Rel and between B and Rels with an arrow pointing to Rel (being a one-to-many association).

Here's what I get:

erd

The dotted line points from A to B, while A and B join the association in a perfectly symmetric way.

Where did the model Liquidator come from?

Even if I am generating a ERD for only one model (using only= option), the Liquidator model shows up in the diagram. I don't have a model called Liquidator at all. Where did it come from?

It seems this Liquidator class only shows up when polymorphism=true is set.

Unable to activate ... activerecord-2.2.2 conflicts with activerecord (>= 3.0)

ON RHEL Linux, using rbenv and ruby 2.1.0.
"bundle install" works, but "rake erd" then fails.

bundle install
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.4)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.2)
Using builder (3.1.4)
Using activemodel (4.0.2)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.2)
Using activerecord (4.0.2)
Using choice (0.1.6)
Using ruby-graphviz (1.0.9)
Using rails-erd (1.1.0)
Using bundler (1.5.3)
Your bundle is complete!
Use bundle show [gemname] to see where a bundled gem is installed.
[art@ip-10-112-49-74 ~]$ rake erd
rake aborted!
Unable to activate rails-erd-1.1.0, because activesupport-2.2.2 conflicts with activesupport (>= 3.0), activerecord-2.2.2 conflicts with activerecord (>= 3.0)
/home/art/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in block in require' /home/art/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:innew_constants_in'
/home/art/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in require' /home/art/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:inblock in require'
/home/art/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in new_constants_in' /home/art/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:inrequire'
/home/art/Rakefile:11:in `<top (required)>'
(See full trace by running task with --trace)

pdf format missing

I'm on OS X 10.6.7 + graphviz 2.26.3 installed via homebrew. Although I can generate .png fles without problems I'm unable to do the same with pdf. Heere is what I get:

Saving diagram failed!
Graphviz produced errors. Verify it has support for filetype=pdf, or use filetype=dot.
Original error: Format: "pdf" not recognized. Use one of: canon cmap cmapx cmapx_np dot eps fig gd gd2 gif gv imap imap_np ismap jpe jpeg jpg plain plain-ext png ps ps2 svg svgz tk vml vmlz vrml wbmp xdot

Any clue?

inheritance error

If I run with inheritance=false, everything looks fine:
Loading application environment...
Loading code in search of Active Record models...
Generating Entity-Relationship Diagram for 21 models...
Done! Saved diagram to ERD.pdf.

If I set inheritance=true, however, I get this:
Loading application environment...
Loading code in search of Active Record models...
Generating Entity-Relationship Diagram for 21 models...
rake aborted!
Saving diagram failed!
Graphviz produced errors. Verify it has support for filetype=pdf, or use filetype=dot.
Original error: Error: lost m_InsurancePolicySfh m_PropertySfh edge

Tasks: TOP => erd => erd:generate
(See full trace by running task with --trace)

with --trace, I get:
/usr/local/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram/graphviz.rb:174:in rescue in block in <class:Graphviz>' /usr/local/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram/graphviz.rb:169:inblock in class:Graphviz'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:142:in instance_eval' /usr/local/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:142:insave'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:120:in create' /usr/local/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:74:increate'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/tasks.rake:41:in block (2 levels) in <top (required)>' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:incall'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in block in execute' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:ineach'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in execute' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:158:inblock in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:ininvoke_with_call_chain'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:176:in block in invoke_prerequisites' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:ineach'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:in invoke_prerequisites' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:157:inblock in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:ininvoke_with_call_chain'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:144:in invoke' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:112:ininvoke_task'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in block (2 levels) in top_level' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:ineach'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in block in top_level' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:instandard_exception_handling'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:84:in top_level' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:62:inblock in run'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in standard_exception_handling' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:inrun'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/bin/rake:32:in <top (required)>' /usr/local/bin/rake:19:inload'
/usr/local/bin/rake:19:in `

'
Tasks: TOP => erd => erd:generate

Tablenames

Hi,

how can I show the id too ? And how can I show the tablenames ?
ERB is great we communicate with the POJP (pretty old javapeople) with this model. The design their Pojos.

Erhard

Don't know how to build task 'erd'

Hi,

rake doesn't seem to know about the erd task:

$ rake erd
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
Don't know how to build task 'erd'

(See full trace by running task with --trace)

I've also tried this with rake 0.8.7, and aside from the deprecation warning disappearing nothing changed.

This is my Gemfile:

$ cat Gemfile

source :rubygems

group :development do
gem "rails-erd"
end

And bundle claims it's all installed correctly:

$ bundle install
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using arel (2.0.10)
Using tzinfo (0.3.29)
Using activerecord (3.0.9)
Using ruby-graphviz (0.9.21)
Using rails-erd (0.4.5)
Using bundler (1.0.15)
Your bundle is complete! Use bundle show [gemname] to see where a bundled gem is installed.

$ bundle show rails-erd
/usr/lib/ruby/gems/1.8/gems/rails-erd-0.4.5

I'm pretty stumped. Here's a full rake trace:

$ rake erd --trace
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
Don't know how to build task 'erd'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task_manager.rb:49:in []' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:111:ininvoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:ineach'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:instandard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:84:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:62:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/bin/rake:32
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

Sam

Generation hangs

It just chills here for hours and the pdf if empty

Generating entity-relationship diagram for 16 models...

No entities found; create your models first!

I have my model "outsourced" into a gem and used to start rails-erd like this:

 bundle exec rake erd inheritance=true --trace

I suppose since the upgrade, this doesn't work for me anymore and I do get this error:

** Invoke erd (first_time)
** Invoke erd:generate (first_time)
** Invoke erd:options (first_time)
** Execute erd:options
** Invoke erd:load_models (first_time)
** Execute erd:load_models
Loading application environment...
** Invoke environment (first_time)
** Execute environment
Loading code in search of Active Record models...
** Execute erd:generate
Generating Entity-Relationship Diagram for 22 models...
rake aborted!
No entities found; create your models first!
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:159:in `block in filtered_entities'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:152:in `tap'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:152:in `filtered_entities'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:128:in `generate'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:119:in `create'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:74:in `create'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rails-erd-1.1.0/lib/rails_erd/tasks.rake:41:in `block (2 levels) in '
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/home/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/task.rb:205:in `block in invoke_prerequisites'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/task.rb:203:in `each'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/task.rb:183:in `block in invoke_with_call_chain'
/home/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/gems/rake-10.0.4/bin/rake:33:in `'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/bin/rake:19:in `load'
/home/username/.rvm/gems/ruby-1.9.3-p0@my_project/bin/rake:19:in `'
Tasks: TOP => erd => erd:generate

Any ideas what might be wrong?

undefined method `clear?'

Hi,

I'm having this problem when I run ERD as a rake task in a Rails project. Running erd works fine, it generates the correct erd.pdf. However, when I run rake erd it exits with the following exception:

yoran@linux-854r:~/Projects/hstry-ed> rake erd --trace
** Invoke erd (first_time)
** Invoke erd:generate (first_time)
** Invoke erd:options (first_time)
** Execute erd:options
** Invoke erd:load_models (first_time)
** Execute erd:load_models
Loading application environment...
** Invoke environment (first_time)
** Invoke rails_admin:disable_initializer (first_time)
** Execute rails_admin:disable_initializer
[RailsAdmin] RailsAdmin initialization disabled by default. Pass SKIP_RAILS_ADMIN_INITIALIZER=false if you need it.
** Execute environment
Loading code in search of Active Record models...
** Execute erd:generate
Generating Entity-Relationship Diagram for 25 models...
rake aborted!
undefined method `clear?' for #<RailsERD::Domain::Attribute:0x000000073049c0>
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:180:in `block (2 levels) in filtered_attributes'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:180:in `each'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:180:in `none?'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:180:in `block in filtered_attributes'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:177:in `reject'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:177:in `filtered_attributes'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:129:in `block in generate'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:128:in `each'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:128:in `generate'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:119:in `create'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:74:in `create'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rails-erd-1.1.0/lib/rails_erd/tasks.rake:41:in `block (2 levels) in <top (required)>'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/home/yoran/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/task.rb:195:in `each'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/task.rb:195:in `invoke_prerequisites'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/home/yoran/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/bin/rake:23:in `load'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/bin/rake:23:in `<main>'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/bin/ruby_executable_hooks:15:in `eval'
/home/yoran/.rvm/gems/ruby-2.0.0-p353@hstryed/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => erd => erd:generate

The weird thing is that it used to work until a few commits ago. I went over the commits and I saw that I only changed one model class. I reverted the change to that model class and it still gives the same error. ERD only scans the models right?

postgis geographic columns

Thanks for such a great gem. I've used it regularly for a while now.

My most recent project involves postgis geographic columns. I think the output is messing up the graphviz transition to pdf.

I think the dot file generates fine. When I run

dot -Tps /home/adam/Desktop/sitata.dot -o /home/adam/Desktop/sitata.ps

I receive the following error:

Error: /home/adam/Desktop/sitata.dot:73: syntax error near line 73
context:   <tr><td align="left" width="130" port="latlng">latlng <font face="Arial Italic" color="grey60">spatial ({:srid=>4326, >>>  : <<< type=>"point", :geographic=>true})</font></td></tr>
Error: bad label format {<table border="0" align="center" cellspacing="0.5" cellpadding="0" width="134">
  <tr><td align="center" valign="bottom" width="130"><font face="Arial Bold" point-size="11">Location</font></td></tr>
</table>
|
<table border="0" align="left" cellspacing="2" cellpadding="0" width="134">
  <tr><td align="left" width="130" port="latlng">latlng <font face="Arial Italic" color="grey60">spatial ({:srid=
Warning: UTF-8 input uses non-Latin1 characters which cannot be handled by this PostScript driver
Error: /home/adam/Desktop/sitata.dot:1: syntax error near line 1
context:  >>> </table> <<< 

My schema for the table looks like:

create_table "locations", :force => true do |t|
    t.spatial  "latlng",     :limit => {:srid=>4326, :type=>"point", :geographic=>true}
    t.datetime "created_at"
    t.datetime "updated_at"
end

and I am using the rgeo and activerecord-postgis-adapter gem

Has anyone else experienced this issue?

Thanks!

"No entities found; create your models first!"

I'm using rails-erd 0.4.3 in a Rails 3.0.4 app with Ruby 1.8.7 and when I run rake erd or rake erd filetype=dot in the Rails root directory I get the following error:

Loading code in search of Active Record models...
Generating Entity-Relationship Diagram for 0 models...
rake aborted!
No entities found; create your models first!

It says I have 0 models but running ls -1 app/models/ | wc -l gives me a result of 48.

Only, Exclude option is not working

Hi,

This libraery is very good to use but there is some issue which fine while using this library.

I am get any output based on only, exclude options.

I have use this rake command from my rails application root directory.

bundle exec rake erd title='ContractPort ER Diagram' exclude="StatusInfo, Setting"

Kindly replay and fix the issues ASAP.

rake erd at windows

C:\Sites\secore>rake erd filetype=pdf --trace
** Invoke erd (first_time)
** Invoke erd:generate (first_time)
** Invoke erd:options (first_time)
** Execute erd:options
** Invoke erd:load_models (first_time)
** Execute erd:load_models
Loading application environment...
** Invoke environment (first_time)
** Execute environment
Loading code in search of Active Record models...
** Execute erd:generate
Generating Entity-Relationship Diagram for 14 models...
Warning: Ignoring invalid association :tagger on ActsAsTaggableOn::Tagging (pol
morphic interface Tagger does not exist)
rake aborted!
Saving diagram failed!
Verify that Graphviz is installed and in your path, or use filetype=dot.
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_
rd/diagram/graphviz.rb:176:in rescue in block in <class:Graphviz>' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_ rd/diagram/graphviz.rb:169:inblock in class:Graphviz'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_
rd/diagram.rb:142:in instance_eval' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_ rd/diagram.rb:142:insave'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_
rd/diagram.rb:120:in create' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_ rd/diagram.rb:74:increate'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_
rd/tasks.rake:41:in block (2 levels) in <top (required)>' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task rb:205:incall'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task
rb:205:in block in execute' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task rb:200:ineach'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task
rb:200:in execute' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task rb:158:inblock in invoke_with_call_chain'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task rb:151:ininvoke_with_call_chain'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task
rb:176:in block in invoke_prerequisites' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task rb:174:ineach'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task
rb:174:in invoke_prerequisites' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task rb:157:inblock in invoke_with_call_chain'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/1.9.1/monitor.rb:201:in mon_synchronize' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task rb:151:ininvoke_with_call_chain'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task
rb:144:in invoke' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appl cation.rb:116:ininvoke_task'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appl
cation.rb:94:in block (2 levels) in top_level' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appl cation.rb:94:ineach'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appl
cation.rb:94:in block in top_level' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appl cation.rb:133:instandard_exception_handling'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appl
cation.rb:88:in top_level' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appl cation.rb:66:inblock in run'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appl
cation.rb:133:in standard_exception_handling' H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appl cation.rb:63:inrun'
H:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:i
<top (required)>' H:/RailsInstaller/Ruby1.9.2/bin/rake:19:inload'
H:/RailsInstaller/Ruby1.9.2/bin/rake:19:in `

'
Tasks: TOP => erd => erd:generate

No entities found; create your models first!

I am having the same problem as #6 but answers given there didn't help, I am not using kaminari, using Rails 3.2.12

Here's output of commands

 $ rails c                               
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require': iconv will be deprecated in the future, use String#encode instead.
Loading development environment (Rails 3.2.12)
[1] pry(main)> Rails.application.config.eager_load_paths
=> ["/Users/dmytro/Development/app/assets",
 "/Users/dmytro/Development/app/controllers",
 "/Users/dmytro/Development/app/helpers",
 "/Users/dmytro/Development/app/mailers",
 "/Users/dmytro/Development/app/models"]
[2] pry(main)>

and trace

$  rake erd filetype=dot --trace                               U feature/user_sms_opt_in:intilligent_saas/.
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require': iconv will be deprecated in the future, use String#encode instead.
** Invoke erd (first_time)
** Invoke erd:generate (first_time)
** Invoke erd:options (first_time)
** Execute erd:options
** Invoke erd:load_models (first_time)
** Execute erd:load_models
Loading application environment...
** Invoke environment (first_time)
** Execute environment
Loading code in search of Active Record models...
** Execute erd:generate
Generating Entity-Relationship Diagram for 12 models...
rake aborted!
No entities found; create your models first!
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:159:in `block in filtered_entities'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:152:in `tap'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:152:in `filtered_entities'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:128:in `generate'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:119:in `create'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374/gems/rails-erd-1.1.0/lib/rails_erd/diagram.rb:74:in `create'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374/gems/rails-erd-1.1.0/lib/rails_erd/tasks.rake:41:in `block (2 levels) in <top (required)>'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/task.rb:228:in `call'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/task.rb:228:in `block in execute'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/task.rb:223:in `each'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/task.rb:223:in `execute'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/Users/dmytro/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/task.rb:187:in `block in invoke_prerequisites'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/task.rb:185:in `each'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/task.rb:185:in `invoke_prerequisites'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/task.rb:165:in `block in invoke_with_call_chain'
/Users/dmytro/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/task.rb:152:in `invoke'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/application.rb:143:in `invoke_task'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/application.rb:101:in `each'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/application.rb:101:in `block in top_level'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/application.rb:110:in `run_with_threads'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/application.rb:95:in `top_level'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/application.rb:73:in `block in run'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/bin/rake:19:in `load'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374@global/bin/rake:19:in `<main>'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374/bin/ruby_noexec_wrapper:14:in `eval'
/Users/dmytro/.rvm/gems/ruby-1.9.3-p374/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => erd => erd:generate

Table '... some table name goes here... ' doesn't exist

Hi all!

I have running rails3 application (using ruby 1.9.2p0 on Ubuntu). I have installed rails-erd (0.3.0).
I've made all migrations and all rebuild my schema.rb and i run all my tests but after i try to run rake erd it gives me error...

Loading Active Record models...
Generating Entity-Relationship Diagram...
rake aborted!
Table '.. some table name ...' doesn't exist

(See full trace by running task with --trace)

Why it wants to run table that does not exist? How can i avoid this?

Class named 'Node' needs to be enclosed in quotes

I have a class named 'Node'. The dot file generated does not have this class name enclosed in quotes, so dot throws an error and this class isn't added to the PDF. If I manually edit the dot file to add quotes (like so: "Node") and manually run dot then the class does appear in the diagram. It's probably easier to just always enclose class names in quotes.

PG error on rake erd task ?

Hi,

We want to use your gem to generate model but i've got an error when lauching rake erd

You could see the concerning model here
https://github.com/ekylibre/ekylibre/blob/master/db/schema.rb

My environment:
Ubuntu 12.04.2 LTS
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
Rails 3.2.13
gem pg (0.15.0)
Postgresql 9.1 with Postgis 2.0.2

The error :

XXXX@ubuntu:~/ekylibre$ rake erd filetype=dot
Loading application environment...
Loading code in search of Active Record models...
Generating Entity-Relationship Diagram for 112 models...
Warning: Ignoring invalid association :resource on JournalEntry (polymorphic interface Resource does not exist)
Warning: Ignoring invalid association :owner on Document (polymorphic interface Owner does not exist)
Warning: Ignoring invalid association :employees on Establishment (uninitialized constant Establishment::Users)
Warning: Ignoring invalid association :owner on Log (polymorphic interface Owner does not exist)
rake aborted!
PG::Error: ERROR:  relation "" does not exist
LINE 5:              WHERE a.attrelid = '""'::regclass
                                        ^
:             SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
              FROM pg_attribute a LEFT JOIN pg_attrdef d
                ON a.attrelid = d.adrelid AND a.attnum = d.adnum
             WHERE a.attrelid = '""'::regclass
               AND a.attnum > 0 AND NOT a.attisdropped
             ORDER BY a.attnum

Tasks: TOP => erd => erd:generate

no entities found

just for documentation, the bug caused by the clickatell gem and fixed by removing it

also could work around it with this monkey patch

class RailsERD::Domain::Specialization
      DumbErd = Struct.new(:name) do
        def generalized?; false; end
      end
      def initialize(domain, generalized, specialized) # @private :nodoc:
        @domain = domain
        @generalized = generalized || DumbErd.new('unknown gen')
        @specialized = specialized  ||  DumbErd.new('unknown spe')
      end
end

also, fixed a bug for class with no table in an association (for whatever reason). Putting this here until I make a Pull Request

class RailsERD::Domain::Relationship
     def foreign_key_required?(association)
        if association.active_record.table_name && association.belongs_to?
          column = association.active_record.columns_hash[association.send(Domain.foreign_key_method_name)] and !column.null
        end
     end
end

"You have a nil object when you didn't expect it!" error

>bundle exec rake erd --trace
(in /Users/asv/git/rt)
** Invoke erd (first_time)
** Invoke erd:generate (first_time)
** Invoke erd:options (first_time)
** Execute erd:options
** Invoke erd:load_models (first_time)
** Execute erd:load_models
Loading application environment...
** Invoke environment (first_time)
** Execute environment
Loading code in search of Active Record models...
** Execute erd:generate
Generating Entity-Relationship Diagram for 22 models...
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/domain/attribute.rb:103:in `limit'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/domain/attribute.rb:115:in `limit_description'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/domain/attribute.rb:95:in `type_description'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/domain/attribute.rb:94:in `tap'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/domain/attribute.rb:94:in `type_description'
(erb):9:in `entity_options'
(erb):8:in `each'
(erb):8:in `entity_options'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/diagram/graphviz.rb:239:in `entity_options'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/diagram/graphviz.rb:181
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:129:in `instance_exec'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:129:in `generate'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:128:in `each'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:128:in `generate'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:119:in `create'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:74:in `create'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rails-erd-0.4.5/lib/rails_erd/tasks.rake:41
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/Users/asv/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/Users/asv/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/bin/rake:31
/Users/asv/.rvm/gems/ruby-1.8.7-p334/bin/rake:19:in `load'
/Users/asv/.rvm/gems/ruby-1.8.7-p334/bin/rake:19

rake task fails

After running:

$ rake erd --trace

I get this:

  Generating Entity-Relationship Diagram for 33 models...
Warning: Ignoring invalid association :tagger on ActsAsTaggableOn::Tagging (polymorphic interface Tagger does not exist)
Warning: Ignoring invalid association :tagger on ActsAsTaggableOn::Tagging (polymorphic interface Tagger does not exist)
rake aborted!
undefined method `name' for nil:NilClass
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/activesupport-3.1.1/lib/active_support/whiny_nil.rb:48:in `method_missing'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/domain.rb:101:in `block (2 levels) in relationships_mapping'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/domain.rb:100:in `each'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/domain.rb:100:in `block in relationships_mapping'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/domain.rb:99:in `tap'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/domain.rb:99:in `relationships_mapping'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/domain.rb:77:in `relationships_by_entity_name'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/domain/attribute.rb:58:in `foreign_key?'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/domain/attribute.rb:40:in `content?'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:178:in `block (2 levels) in filtered_attributes'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:178:in `each'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:178:in `none?'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:178:in `block in filtered_attributes'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:175:in `reject'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:175:in `filtered_attributes'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:129:in `block in generate'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:128:in `each'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:128:in `generate'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:119:in `create'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/diagram.rb:74:in `create'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rails-erd-0.4.5/lib/rails_erd/tasks.rake:41:in `block (2 levels) in <top (required)>'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:205:in `call'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:200:in `each'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:176:in `block in invoke_prerequisites'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:174:in `each'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:174:in `invoke_prerequisites'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:157:in `block in invoke_with_call_chain'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:94:in `each'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/home/vagrant/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/rake/application.rb:63:in `run'=

.....

It does not tell me which model it is processing when it fails. I'm running rails 3.1.1 and rail-erd 0.4.5.

Also, is there any way to include/exclude particular models from the diagram? I didn't see one in the docs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.