ruby on rails - Adding new embedded_in documents into a pre-existing document -
i attempting teach myself rails mobile development course. instructor uses python , jinja said use on own. upcoming project need create app uses nosql database. using mongodb, mongoid.
i have 2 models, verb , tense, verb embeds_many tenses. want able have link verb show page new form fill out new tense embed in said verb.
i have found many examples using nested forms create both @ same time not create new document embed in existing one.
since new rails may getting verbiage incorrect can't find looking for. either answer or direction go appreciated.
here models have set up. if need provide more please let me know.
class verb include mongoid::document embeds_many :tenses, class_name: "tense" field :first, type: string field :second, type: string field :third, type: string field :fourth, type: string index({first: 1}) end class tense include mongoid::document embedded_in :verb, :inverse_of => :tenses field :name, type: string field :abbrv, type: string field :voice, type: string field :mood, type: string index({abbrv: 1}) end
Comments
Post a Comment