Skip to content

Commit 98925c0

Browse files
authored
MONGOID-5533: Unnecessary edits to Comment model in Rails Getting Started (#5512)
* Add note about workaround for MONGOID-4885 in Rails 6 docs * Fix whitespace
1 parent 50705be commit 98925c0

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

docs/tutorials/getting-started-rails6.txt

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

278282
Open the post show view file, ``app/views/posts/show.html.erb``, and add
279283
a section rendering existing comments and prompting to leave a new comment:

0 commit comments

Comments
 (0)