jeudi 3 novembre 2016

Override method initialize mongodb, ArgumentError: wrong number of arguments (given 1, expected 0)

i have two class, User and Token

class User
  include Mongoid::Document
  embeds_one :token
end

class Token
  include Mongoid::Document
  embebed_in :user
  def initialize 
    super
  end
end

When i try build token for User.first i use

User.first.build_token

But don't work for me.

ArgumentError: wrong number of arguments (given 1, expected 0)

How do fix this error?

Aucun commentaire:

Enregistrer un commentaire