@@ -259,21 +259,25 @@ association for the comments:
259259 has_many :comments, dependent: :destroy
260260 end
261261
262- Open the ``Comment`` model file, ``app/models/comment.rb``, and change the
263- generated ``embedded_in`` association to ``belongs_to``:
262+ .. note::
263+ *The following is only required if using a version of Mongoid < 7.0.8 or 7.1.2 (see*
264+ `MONGOID-4885 <https://jira.mongodb.org/browse/MONGOID-4885>`_ *for details)*
264265
265- .. code-block:: ruby
266- :name: app/models/comment.rb
267- :caption: app/models/comment.rb
266+ Open the ``Comment`` model file, ``app/models/comment.rb``, and change the
267+ generated ``embedded_in`` association to ``belongs_to``:
268268
269- class Comment
270- include Mongoid::Document
269+ .. code-block:: ruby
270+ :name: app/models/comment.rb
271+ :caption: app/models/comment.rb
271272
272- field :name, type: String
273- field :message, type: String
273+ class Comment
274+ include Mongoid::Document
274275
275- belongs_to :post
276- end
276+ field :name, type: String
277+ field :message, type: String
278+
279+ belongs_to :post
280+ end
277281
278282Open the post show view file, ``app/views/posts/show.html.erb``, and add
279283a section rendering existing comments and prompting to leave a new comment:
0 commit comments