gak4u
gak4u

Reputation: 80

Unable to create document in mongoid with field type array

Following is my model which has a field with type array

class User::Log::Presentation
  include Mongoid::Document
  include Mongoid::Timestamps

  field :name, type: String
  field :fields, type: Array, default: []
end

When I try creating a document, it throws following error.

TypeError: no implicit conversion of String into Integer

I am totally lost with this. Couldnt find any answer is other questions. Please help.

Upvotes: 0

Views: 142

Answers (1)

gak4u
gak4u

Reputation: 80

I did the following change and started working.

field :fields, type: Array, default: []

to

field :columns, type: Array, default: []

Upvotes: 1

Related Questions