see list of loans on users/:id
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x


Given Im on notes/:id
When i click Go to My Profile (current_user_path?)
Then I should be redirected to users/:id and 
then I should see a link to notes/:id


Given I'm on users/:id
When I click a Loan
Then I should be redirected to notes/:id

If you just send a PR with tests, I can add a change description and merge it in.

awarded to kc00l

Crowdsource coding tasks.

1 Solution

Winning solution

My pull request :

Summary of changes:

  1. Added a link to current user profile page in navigation section of application layout
  2. Created a relationship between note and the user who created it
  3. Added notes list in user profile page
  4. Added specs to test access to loan from user profile page
  5. Added specs to test note belonging to user after creation


In order to implement this feature I had to add a basic relationship between a note and a user (I chose the user who created the note, without specifying the lender or the borrower, this could change in the future). The note ownership is fixed to the current_user by means of a hidden :user_id field in the notes form and by forcing the current_user id in the new action of NotesController.

Once I ensured that this feature successfully passed I added the user notes list to his profile page (I used the users#show view) with links to each note page.


Once more, you should think if you allow both the lender and the borrower to create a note or just one of the parties. Maybe this could be specified before note creation by a select menu on the home page or better by two different big buttons (I am the Lender, I am the Borrower). And then fill up a note field "created_by" with values of "lender" or "borrower" and thus identify the current_user as a lender or a borrower by means of this field and his user_id (this could be simpler than using two different user models for borrower and lender, we'll see).

@kc00l Hints and Changes noted and will continue to think about! Also created a $100 bounty! Link:
apr over 6 years ago