goldylucks
goldylucks

Reputation: 6144

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

I'm using mongoid-enum gem exactly like the spec

class AdVariation
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Enum

  enum medium: [:google, :facebook]
end

and when I run AdVariation.new I get:

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

The repo isn't maintained and doesn't answer questions/bugs

Did anyone stumble upon this?

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

Upvotes: 1

Views: 561

Answers (1)

goldylucks
goldylucks

Reputation: 6144

turns out the documentation on the gem is wrong. The right way is:

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

Upvotes: 1

Related Questions