Skip to main content

Repost / Retweet / Reblog Discussion

General • Asked by Chris Oliver
9d7f0b771e28ff105feab480cc8704c0

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


2e2231c42b734347ef18ca82f12506d7

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


6ba7ca7e0eb26a1ef9b92f408442001d

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?!


B0b392b758a6149d57d39528996edeac
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. 
Ce795239ba5dd2384fc2f88ffaff5451
Great to hear Dan! Let me know if there are any other features like this you'd like to see!

E8c9f700cf8778fcb35fea210aa78200
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!

E8c9f700cf8778fcb35fea210aa78200
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.

9d7f0b771e28ff105feab480cc8704c0

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

Ce795239ba5dd2384fc2f88ffaff5451

Retweets is simply a count the number of associated tweets.

@tweet.tweets.count


9d7f0b771e28ff105feab480cc8704c0

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.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 18,000+ developers who get early access to new screencasts, articles, guides, updates, and more.

By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

More of a social being? We're also on Twitter and YouTube.