Mongoid::Errors::DocumentNotFound: Document(s) not found for class Proof with id(s) 531d064b5cf4e8d51d000002
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

Would you be able to get me over this next hurdle? I'm trying to figure out the piece of code I need to get over the next failure. The failure is in the commit message.
https://github.com/akshatpradhan/compliance_chimp/commit/e7cb93fe0710d68346b5166fbf60e7e1b4df20e4

awarded to sguha

Crowdsource coding tasks.

2 Solutions

Winning solution

Check out pull request https://github.com/akshatpradhan/compliance_chimp/pull/12

Basically, I added an update action to the ProofsController and routes.rb which is used to process the form when a user edits a Proof object. On a successful update, I redirect the user to their home page which seems to be what you are expecting given your test setup. Also, I cleaned up some references to standard and proof


My 2 cents to add sugar to @sguha solution which perfectly solves the issue.

  1. This is the time to review User < -- > Proof and User < -- > Standard relationships modeling. In the current modeling you are looping over Standard records in the database and for each record you are rendering all proofs. You should introduce the concept of proof for a given standard record belonging to the current user. Hint : add a user_id field to the Proof model and assign this field by means of a hidden field in the proof form.
  2. The proof creation/editing views can be simplified. The proofs/new view can be removed in favor of an inline form in users/show (such as the Rails guides nested resources example: http://guides.rubyonrails.org/v3.2.14/getting_started.html#generating-a-controller). The proofs/edit view can be either left untouched or some AJAX/Rails magic can be introduce to allow updating the proof in place (some AJAX could also be used for proof creation to avoid page refresh after submitting the proof form).
@kc00l I think you're right. I'm going to hold off on this branch and square away the User <-> Proof and User <-> Standard relationship
akshatpradhan over 5 years ago
I agree with @kcool. If you need any help, you can message create issues on github and let me know.
sguha over 5 years ago
@sguha and @kc00l I am having a very hard time with the User <-> Proof association. I really don't know how to construct this test and make it pass. https://github.com/akshatpradhan/compliance_chimp/commit/11143fcaada48fce8c6fb2b65bc2df3575f2d7bc How would I be able to get over this hurdle?
akshatpradhan over 5 years ago
I added some line comments in this commit to help you going forward without writing all the code myself ;) I think you're in the right way, you just need some quick hints. Feel free to make bigger steps once specs pass (they should, I haven't tried though).
kc00l over 5 years ago
I just updated the comment with a question!
akshatpradhan over 5 years ago
View Timeline