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?
Comment by msokkThursday Feb 06, 2014 at 19:12 GMT
Do you have i18n-tasks in Gemfile? If so, try without it.
i18n-tasks has term-ansicolor dependency. Both rails-erd and term-ansicolor have Attribute class, which somehow gets mixed up with rails-erd.
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 runrake erd
it exits with the following exception: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?