You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EDIT [Just realized these problems may be due to me using Rails 5.2.0, not 4.0.0 as in the tutorial. if so, sorry :-)]
After creating comments and tags functionality, the delete article function breaks. A solution is to edit the article.rb file to include; dependent: :delete_all
in the lines:
I discovered this by comparing my work to other students', since I found no explanation of this in the tutorial itself. I hate blindly copying stuff I have not understood, and since this is likely to be the first Rails app development done by us students, this seems to be a flaw (that might well confuse and demotivate).
Similarly, to be able to delete tags, tag.rb needs to include the line:
has_many :taggings, dependent: :destroy
Again, this is not explained in the tutorial, nor the related concept(s). I did find a StackOverflow post that touched on this, however (after laboriously checking all my files against another student's, and then googling the 'dependent: :destroy' term!).
Is this best practice? How do these terms solve the issues that not having them creates (Foreign key errors)? It seems unlikely that most beginner students will find these solutions, never mind understand them.
The text was updated successfully, but these errors were encountered:
jinjagit
changed the title
No explanation of 'dependent: :delete_all', which seems necessary
Blooger2: No explanation of 'dependent: :delete_all', which seems necessary
Sep 23, 2018
jinjagit
changed the title
Blooger2: No explanation of 'dependent: :delete_all', which seems necessary
Blooger2: No mention of 'dependent: :delete_all', which seems necessary
Sep 23, 2018
jinjagit
changed the title
Blooger2: No mention of 'dependent: :delete_all', which seems necessary
Blogger2: No mention of 'dependent: :delete_all', which seems necessary
Sep 23, 2018
EDIT [Just realized these problems may be due to me using Rails 5.2.0, not 4.0.0 as in the tutorial. if so, sorry :-)]
After creating comments and tags functionality, the delete article function breaks. A solution is to edit the article.rb file to include;
dependent: :delete_all
in the lines:
has_many :comments, dependent: :delete_all
has_many :taggings, dependent: :delete_all
I discovered this by comparing my work to other students', since I found no explanation of this in the tutorial itself. I hate blindly copying stuff I have not understood, and since this is likely to be the first Rails app development done by us students, this seems to be a flaw (that might well confuse and demotivate).
Similarly, to be able to delete tags, tag.rb needs to include the line:
has_many :taggings, dependent: :destroy
Again, this is not explained in the tutorial, nor the related concept(s). I did find a StackOverflow post that touched on this, however (after laboriously checking all my files against another student's, and then googling the 'dependent: :destroy' term!).
Is this best practice? How do these terms solve the issues that not having them creates (Foreign key errors)? It seems unlikely that most beginner students will find these solutions, never mind understand them.
The text was updated successfully, but these errors were encountered: