aasm-diagram icon indicating copy to clipboard operation
aasm-diagram copied to clipboard

fix: missing subclass transitions

Open ObscurePlatypoctopus opened this issue 3 years ago • 5 comments

Fixes #11

Caveat: The way it gets called changes with this, instead of creating an instance of the class with the state machine, call diagram on the class state machine instead.

ObscurePlatypoctopus avatar Apr 12 '21 04:04 ObscurePlatypoctopus

@Katee, @ObscurePlatypoctopus is correct and this PR fixes the issue. Also, the calling convention seems to be "better" (the AASM DSL evaluates at class level) and does not break backward compatibility.

@ObscurePlatypoctopus welcome! And thank you for the PR!

Some quick notes/observations:

  • bundler version update might be too high; the lowest version of supported aasm is 4.12, which requires ruby at minimum 1.9.3, thus it might depend on bundler from 1.x branch.
  • you might want to also update the generate.rake to use the new calling convention (for completeness).

Again, thank you for the fix!

mihaimuntenas avatar Apr 12 '21 13:04 mihaimuntenas

@mihaimuntenas Thank you for the notes! I think the Ruby version I was using did not support the older bundler, but I don't think the upgrade was required after all so I removed it.

I also adjusted the rake task as per your notes, but I did not manage to verify it yet. I think there may be another issue in the Rakefile where

puts 'Missing `model` argument.' unless args[:model].present?

fails if not using rails, because string.present? is missing. I'm assuming aasm is usually used with rails so maybe this is not a big deal.

ObscurePlatypoctopus avatar Apr 14 '21 01:04 ObscurePlatypoctopus

@ObscurePlatypoctopus you are so right! I actually use it in a Rails project, but I should come up with a fix for that - in the end, it is a Rake task, not a Rails task :) ... And, as pointed out, there is no dependency on Rails.

mihaimuntenas avatar Apr 14 '21 06:04 mihaimuntenas

@Katee Is there anything this needs before it can be merged?

ObscurePlatypoctopus avatar May 11 '21 14:05 ObscurePlatypoctopus

@Katee Would be nice if it was merged

adis-io avatar Aug 09 '22 14:08 adis-io