mongoid enum ArgumentError: wrong number of arguments (given 1, expected 2..3)

mongoid enum ArgumentError: wrong number of arguments (given 1, expected 2..3)

我使用 mongoid-enum gem 与 spec

完全一样
class AdVariation
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Enum

  enum medium: [:google, :facebook]
end

当我 运行 AdVariation.new 我得到:

ArgumentError: wrong number of arguments (given 1, expected 2..3)

repo 未维护且未回答 questions/bugs

有人偶然发现这个吗?

$ bundle show | grep mongoid
* mongoid (5.4.0)
* mongoid-enum (0.4.0)

原来 gem 上的文档是错误的。正确的方法是:

enum :medium, [:google, :facebook], default: nil