Ruby on Rails Thursday, April 28, 2016

I found one solution that stores the reposted data within a content
field on the model, but of course that's not a good approach. If I can
use only the object's ID, I think that would slim down the amount of
data being used. The old method is below, maybe you have a better
solution with AJAX.

Post model
has_many: reposts, class_name: "Post", foreign_key: "repost_id",
dependent: :destroy;

def repost
content: orig_post.content,;
respond_to do |format|

Posted via

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment