I'm new to Ruby and I'm trying to make a finite state machine chain with AASM gem. I want to check if a string is unique (not exist in database). And I made a small piece of code to start with:
state :Beginning, :initial => true
event :UniquenessChecking do
print "Check uniqueness"
transitions :from => :Beginning, :to => :CheckUniqueness
term = Term.new("textstring")
`initialize': wrong number of arguments (1 for 0) (ArgumentError)
from try.rb:24:in `new'
from try.rb:24:in `<main>'
initialize inside of the
aasm block, just move it out of that block:
require 'rubygems' require 'aasm' class Term include AASM def initialize(term) print term end aasm do # ... end end