karl

Joined

120 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in Some good ways of seeding data in my app?

Awesome, thanks so much Chris!!

Posted in Some good ways of seeding data in my app?

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!

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.