aasm-diagram
aasm-diagram copied to clipboard
fix: missing subclass transitions
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.
@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 supportedaasm
is 4.12, which requiresruby
at minimum 1.9.3, thus it might depend onbundler
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 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 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.
@Katee Is there anything this needs before it can be merged?
@Katee Would be nice if it was merged