def generate_message(name, values = [])
      message = (@messages[name] || self.class.default_messages[name])

      # Check whether there are actually any values to interpolate to avoid
      # any warnings
      if message.scan(/%./).any? { |match| match != '%%' }
        message % values.map { |value| value.last }
      else
        message
      end
    end
def generate_message(name, values = [])
      message = (@messages[name] || self.class.default_messages[name])

      # Check whether there are actually any values to interpolate to avoid
      # any warnings
      if message.scan(/%./).any? { |match| match != '%%' }
        message % values.map { |value| value.last }
      else
        message
      end
    end
Generates the message to use when invalidating the given object after
 failing to transition on a specific event