James Ferguson


1,710 Experience
16 Lessons Completed
0 Questions Solved


Posted in Liking Posts Discussion

Hi Chris,

I've got this working well without ajax, but as soon as I add 'remote: true' I get a 404 error in the console. The button is pressed, but doesn't update.

Any ideas as to why this is?

Awesome. Thanks for the in-depth response Chris. Really appreciate it.

I'll have a go at it tonight.


Hi Chris,

I'm interested in implementing a feature similar to Youtube's watched feature. Where after you've watched a video, a small semi transparent overlay is placed over the video thumbnail with the words "watched".

I've implemented something of my own, but it not very efficient. Each video on the page needs to be looked up to see if the member has watched it. Each response takes 0.4ms times n, where n is the number of videos on the page. So the page load might be more than 6-7 seconds (15 videos on the index page).

How would you suggest I do something like this, so I could achieve the same functionality but with less database requests?

Thanks, James

Posted in Liking Posts Discussion

Awesome, many thanks ;)

Posted in Liking Posts Discussion


Any idea what query I could put in my user model to find out all posts that have not (yet) been liked by the user?

Posted in Liking Posts Discussion

Chris, very useful screencast.

I can get it to work well with just rails, but when I implement ajax I get the following error.

"ActionView::Template::Error (undefined method `likes' for nil:NilClass):"

I've customized it a bit by making polymorphic 'likeable' likes.

Posted in Comments With Polymorphic Associations Discussion


Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.