Created
April 25, 2012 00:51
-
-
Save mikeymicrophone/2485002 to your computer and use it in GitHub Desktop.
steps in feature development: comment on notes, tag notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Commenting on notes: | |
- generate comments scaffold (controller, model, migration, views) | |
- add comment link and comment form spot to comment partial | |
- tell CommentsController#new to respond to JS requests | |
- create new.js.erb partial for comments controller | |
- the js partial updates the designated spot with the designated HTML (a new partial we created to render a comment form) | |
- the partials use params[:note_id] to find the right spot and prepare the form to communicate with the server | |
- :note_id is added to the comment link as a parameter | |
- use note.comments to print out comments on the note show page | |
- tell the comments controller to redirect to the note after the comment is saved | |
Tagging notes | |
- rename the picture_id field on the tagging model and add a taggable_type so the relationship is now polymorphic | |
- update the tagging form so that it deduces both id and type from the taggable object | |
- update the has_many relationship in tagging.rb, tag.rb, picture.rb | |
- add the has_many relationship to note.rb | |
- copy the form to the notes show page | |
- copy the tag readout to the notes show page | |
- update the tags show page so it can display either a picture's or a note's title | |
- write the method 'title' for notes so it can conform to that display template |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment