# File lib/state_machine/machine.rb, line 1733 def define_scopes(custom_plural = nil) plural = custom_plural || pluralize(name) [name, plural].uniq.each do |name| [:with, :without].each do |kind| method = "#{kind}_#{name}" if scope = send("create_#{kind}_scope", method) # Converts state names to their corresponding values so that they # can be looked up properly define_helper(:class, method) do |machine, klass, *states| values = states.flatten.map {|state| machine.states.fetch(state).value} scope.call(klass, values) end end end end end