karl
Joined
Activity
Awesome, thanks so much Chris!!
I need some seed data for my app. How do I seed Devise users, and always as images for Paperclip?
Posted in How do I implement voting in Rails?
Thank you so much! Perfect answer. Figured it out.
Posted in How do I implement voting in Rails?
I have an app that has a resource called 'pins'. I want to add upvoting, and possibly downvoting, to the pins, so that I can rank them on the site Sort of like Reddit karma. I was thinking that an association called votes
should be created that belongs_to
a pin (which also has_many
votes). How do you think I should go about this? Also, how can I differentiate in the voting object that whether it's an upvote or downvote?
Another thing, on the client side, when a user clicks upvote, how do I increment the current vote count showing on the site without reloading the page? How do I do this with JavaScript? When I tried to do this, it increases the number for all pins showing on the site, when I had clicked upvote for only one pin. Maybe this had to do with me using a single class for all the pins. What's a really good solution to this, so that the process looks seamless on the user side (number simply increments when clicked). Thanks!