jatwell93 / rubyproject

1 stars 1 forks source link

Comments - Disqus - SQL Issue #5

Closed Mirv closed 7 years ago

Mirv commented 7 years ago

There's a block somewhere in the schema file that keeps calling out to comments section, but it's got a machine character in the normal character set. It's preventing further migrations & blocking test suite.

Going to branch to recipeVersion2 & systematically test each file.

Mirv commented 7 years ago

I'm thinking this is basically done - but not sure what else might be missing from schema from this one - I noticed user model was missing username afterwards - but wasn't sure it was an old migration that stuck it in there. We probably need to do a diff check once we commit the schema from recipeVersions2 branch.

Mirv commented 7 years ago

Test suite fails over the :comments not existing ... I can't goto disquis (firewall) forums to see what the error is all about or fix it.

To keep working on it - I have a branch where I commented out all the spots which reference the comment system.

This is my highest priority, as it's fouling up the whole test suite & without - we can't fix anything reliably (I've corrected the current_user versus User.find thing 3 or 4 times).

Commenting out testing related to commenting first - just to see if that works before I rip out the comment system completely.

/test/controllers/reviews_controller_test.rb:
    21:       post :create, review: { comment: @review.comment }
    38:     patch :update, id: @review, review: { comment: @review.comment }

/test/fixtures/bodyweights.yml:
    5: # below each fixture, per the syntax in the comments below

/test/fixtures/comments.yml:
    5:   commentable_id: 1
    6:   commentable_type: MyString
    10:   commentable_id: 1
    11:   commentable_type: MyString

/test/fixtures/reviews.yml:
    4:   comment: MyText
    7:   comment: MyText

/test/fixtures/users.yml:
    5: # below each fixture, per the syntax in the comments below

/test/models/comment_test.rb:
    3: class CommentTest < ActiveSupport::TestCase
Mirv commented 7 years ago

Phase 2: comment out all controller / model hooks

/app/controllers/reviews_controller.rb:
    72:       params.require(:review).permit(:comment)  # Left this one for now

/app/models/recipe.rb:
    10:     has_many    :comments, as: :commentable

/app/models/workout.rb:
    11:   has_many    :comments, as: :commentable
    12:   has_many :comments, as: :commentable

/app/views/reviews/_form.html.erb:
    15:     <%= f.label :comment %><br>
    16:     <%= f.text_area :comment %>

/app/views/reviews/_review.json.jbuilder:
    1: json.extract! review, :id, :comment, :created_at, :updated_at

/app/views/reviews/index.html.erb:
    10:       <th>Comment</th>
    18:         <td><%= review.comment %></td>

/app/views/reviews/show.html.erb:
    6:   <strong>Comment:</strong>
    7:   <%= @review.comment %>
Mirv commented 7 years ago

Just so you saw it - this will have some implications on testing & comments - but I don't have a way around it. https://github.com/jatwell93/rubyproject/commit/913f49ab63b4c8c94ddeeb5ced7f4c81c35e0b5e

jatwell93 commented 7 years ago

Jeez I had no idea the comments were such an absolute shit storm. Thanks for spending so much time on it, i would have had literally no idea how to fix it.

Not sure if this helps but this is the article i used to create the original comment feature https://www.sitepoint.com/nested-comments-rails/ However, it gave me so many errors; i tried to just delete it all manually (another cautionary tale on not working on the master). So i just switched over to disqus.

Mirv commented 7 years ago

I love the link - haven't done a comment system myself - but good stuff! I'm going to skip reading it for now - but as we go along I'll be able to reference it for whenever I'm stumped!