NoMethodError: undefined method `id' for nil:NilClass
Closed this issue · 10 comments
2.4.0 :182 > AASMDiagram::Diagram.new(rfq.aasm, 'Bug.png')
NoMethodError: undefined method `id' for nil:NilClass
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/ruby-graphviz-1.2.3/lib/graphviz/edge.rb:196:in `getNodeNameAndPort'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/ruby-graphviz-1.2.3/lib/graphviz/edge.rb:31:in `initialize'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/ruby-graphviz-1.2.3/lib/graphviz.rb:210:in `new'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/ruby-graphviz-1.2.3/lib/graphviz.rb:210:in `add_edges'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/aasm-diagram-0.1.0/lib/aasm_diagram/diagram.rb:30:in `block (2 levels) in draw_edges'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/aasm-diagram-0.1.0/lib/aasm_diagram/diagram.rb:26:in `each'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/aasm-diagram-0.1.0/lib/aasm_diagram/diagram.rb:26:in `block in draw_edges'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/aasm-diagram-0.1.0/lib/aasm_diagram/diagram.rb:25:in `each'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/aasm-diagram-0.1.0/lib/aasm_diagram/diagram.rb:25:in `draw_edges'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/aasm-diagram-0.1.0/lib/aasm_diagram/diagram.rb:15:in `draw'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/aasm-diagram-0.1.0/lib/aasm_diagram/diagram.rb:8:in `initialize'
from (irb):182:in `new'
from (irb):182
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/railties-5.0.6/lib/rails/commands/console.rb:65:in `start'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/railties-5.0.6/lib/rails/commands/console_helper.rb:9:in `start'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:78:in `console'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/ahmadyakobbinabaidullah/.rvm/gems/ruby-2.4.0@eproc/gems/railties-5.0.6/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Thank you for your report @abigoroth!
Do you have Graphviz and ruby-graphviz
installed correctly? You might be able to test by using another gem that depends on Graphviz such as rails-erd.
If Graphvis and ruby-graphviz
are installed correctly then it might be something odd about your rfq
model. Is that project open source? I'd be happy to test aasm-diagram
on that specific model if it is.
@Katee I have ruby graphiz, since I can generate diagram for Matsuda's stateful_enum gem . I also made a quick gem which act as middleware for AASM gem to generate diagram via stateful_enum. Here is DrawMe gem
@Katee I'm getting the exact same error. I can run rails-erd normally.
Since its a private repository I'm working on, I'm not allowed to share the model code here, but I can send it to you in pvt if you are willing to test it.
@fabianoarruda if you could share an example that would be very helpful. My email is hi@kate.io.
Same here.
I have 2 AASM models in my private repo. I made diagram for first one easily and got same error with second, a bit more complex one.
Actually got this fixed on my fork
Feel free to use it with gem 'aasm-diagram', github: 'Mayurifag/aasm-diagram', require: false, group: :development
in your Gemfile, untill this issue getting fixed on its main repo.
@abigoroth it seems I didn't pass the "code review".
Here's the email thread I had about @Mayurifag's fork.
I really am happy to merge in a quick fix (especially if it includes tests!). I still need to figure out open source contributions at my new job.
Made a small fix/PR #5 to solve this. Sorry for no tests, but wasn't exactly straight-forward to try and write specs for this (a lot of aasm
models would have to be stubbed/created)