Ask A Question


You’re not receiving notifications from this thread.

Repost / Retweet / Reblog Discussion

Discussion for Repost / Retweet / Reblog

Thanks Chris! Sure, would love to see the follow and following relationship added to this in future.


Thanks Chris!! Would love to see the follow and following relationship added to this in the future too


Hi Chris, Great tutorial! I was wondering how to setup liking posts when I don't have any user records. Assuming I want to setup it for my blog and for sure I'm going to be the only user so how could I implement it?!

This was just what I needed, man. I tried to build out this feature myself and I ended up making it way more complicated than it should have been. I also now understand a few more things about Rails, so thanks for this. 
Great to hear Dan! Let me know if there are any other features like this you'd like to see!
Hey Chris, you may have forgotten one important component for this feature. The unsharing AJAX button for the second state. Currently, my repost feature breaks when I mistakenly double click and record the changes into the db. Can you provide a quick update to this solution to balance it out and then post the updated repository link? Thanks!
Its such a unique solution that its very hard to alter without complicating the logic. Also, we should be able to get the count for the shares, and also access the users that shared the posts. Example: rebecca, john, toby, tyler shared.

Any help on this please; how can I count the number of times the original tweet has been retweeted?


Retweets is simply a count the number of associated tweets.



Thanks for the quick response Chris.
I have tried @tweet.tweets.count on the tweet show page but I'm getting an error " undefined method `tweets' for #Tweet:0x007ffcab0608d8
Did you mean? tweet
tweet= "

This is showing in the console

=> #<ActiveRecord::Relation [#<Tweet id: 1, user_id: 1, body: "First tweet", tweet_id: nil, created_at: "2018-09-06 04:14:56", updated_at: "2018-09-06 04:14:56">, #<Tweet id: 2, user_id: 2, body: "second tweet", tweet_id: nil, created_at: "2018-09-06 04:16:58", updated_at: "2018-09-06 04:16:58">, #<Tweet id: 3, user_id: 2, body: nil, tweet_id: 1, created_at: "2018-09-06 04:25:34", updated_at: "2018-09-06 04:25:34">, #<Tweet id: 4, user_id: 1, body: nil, tweet_id: 2, created_at: "2018-09-06 04:54:44", updated_at: "2018-09-06 04:54:44">, #<Tweet id: 5, user_id: 1, body: nil, tweet_id: 2, created_at: "2018-09-09 12:09:01", updated_at: "2018-09-09 12:09:01">

Apart from this, everything else work fine for me in this tutorial.


Any solutions for the challenge at the end to add a modal with the ability to add a comment to a retweet?

main thing im struggling with is the form in the modal to add the comment (body) for a retweet


This video was a little too quick to absorb all the info


Any update on the follow-up video? Am interested

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 83,038+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.