Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8244773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:57:59+00:00 2026-06-07T21:57:59+00:00

I want to impliment something which is similar to Twitter Repost System, therefore I

  • 0

I want to impliment something which is similar to Twitter Repost System, therefore I will use this as an example. So let’s say I have a Tweet Model and I want to allow other user to repost a certian tweet of another user, how do I impliment something like this?
I thought I would be a cool idea to put the retweet class into the tweet to be able to acess the repost too when I use Tweet.all to recive all tweets stored in the database, but somehow I didn’t worked as expected…
The following Code is just an example which should show how to impliment this even if it is not working…
Any ideas how I could build a working repost model which also allows me to access both tweets and retweet by using Tweet.all?

class Tweet
  class Retweet
    include DataMapper::Resource

    belongs_to :user, key => true
    belongs_to :tweet, key => true
  end

  include DataMapper::Resource
  property :text, String
  property :timestamp, String

  belongs_to :user
end

Important: I should be carrierwave compatible.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:58:01+00:00Added an answer on June 7, 2026 at 9:58 pm
    class Tweet
      include DataMapper::Resource
      property :id, Serial
      has n, :retweets, 'Tweet', :child_key => :parent_id
      belongs_to :parent, 'Tweet', :required => false
      belongs_to :user
    
      def is_retweet?
        self.parent_id ? true : false
      end
    end
    
    original = Tweet.create :user => user1
    retweet = Tweet.create :parent => original, :user => user2
    retweet.is_retweet? # => true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement something a bit similar to django fixture system where in
Basically I want to implement something similar to the the cell-coloring which is defined
I'm making something similar to Polyworld, which means I will be simulating virtual worlds
I want to implement HTTP streaming server, which is similar to this (http://www.ioncannon.net/programming/452/iphone-http-streaming-with-ffmpeg-and-an-open-source-segmenter/) But,
I want to implement something like Col3 = Col2 + Col1 in SQL. This
I want to implement something simple like /System/Workflows/Sample Workflow with the small addition of
I want to implement in my webpage something similar to google search page. The
I want to do something like this: I tried to implement it by myself
I have a requirement in my iPhone app which is something similar to Handwriting
I want something like this public abstract class abc { public abstract void test();

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.