ruby - Mongoid not save embedded documents -
i'm trying save card board (board persisted):
def createcard(user, board, section, color) res = false ua = useraccount.find_by(username: user) board = board.find_by(_id: board) card = card.new card.section = section card.color = color card.changes board.cards << card homecoming card end
this method homecoming card persisted id if search board, doesn't contain cards field.
you need save board after adding card record it, in order changes take effect. before homecoming card:
def createcard(user, board, section, color) #... board.save homecoming card end
ruby mongodb mongoid
No comments:
Post a Comment