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 6044303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:59:46+00:00 2026-05-23T06:59:46+00:00

Hey I have a problem with the extension of the existing dependency models. Well,

  • 0

Hey I have a problem with the extension of the existing dependency models. Well, according to
between the models are as follows:
I have a User model:

class User <ActiveRecord::Base 
 has_many :words, :through => :memo_words 
 has_many :memo_words, :dependent => :destroy 
end 

class MemoWord 
  belongs_to :user 
  belongs_to :word 
end 

class Word 
  has_many :translations, :dependent => :destroy 
  has_many :memo_words, :dependent => :destroy 
end 

class Translation 
  belongs_to :word 
end 

This is a diagram now:
http://img221.imageshack.us/img221/4232/przedik.png

Word model represents a word in one language and the model represents the Translation translation of individual words. I want to resolve the situation when a record in the table and the Word, there is no record Translation (word has no translation). I want to allow for user to add their own translations, but translations done by adding a local (per user). Due to the lack of relationship between Translation and User, the User is not possible to add words. And I question whether a good solution is to add the model UserTranslation:

UserTranslation class 
  belongs_to :word 
  belongs_to :user 
end 

And diagram with situation after change.
http://img851.imageshack.us/img851/7269/75031527.png

Which would have the same functionality as the model of Translation. In practice, I would have to copy the model to UserTranslation Translation by adding only ‘belongs_to :user’. Is there a better approach to the problem

  • 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-05-23T06:59:47+00:00Added an answer on May 23, 2026 at 6:59 am

    I would suggest that in your current scheme consider UserTranslations to be STI for Translations so –

    class UserTranslation < Translation
      belongs_to :user
    end
    

    This way all user translated words will be saved inside “translations” table but with type “user_translations”. Then you may make id unapproved by default and build admin side approval functions.

    This way, @word.translation would yield either translation or user_translation object.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey I have a small problem with my rake class CreateEvents < ActiveRecord::Migration def
Hey I have a problem comparing the value of a CGPoint (struct with two
Hey I have a problem with the validation and upload of apps to the
Hey all, i have a problem with trying to get 2 forms to close
Hey guys, I have a weird problem. I have an update system that refreshes
hey guys having this really simple problem but cant seem to figure out have
Hey this is the weirdest problem i've ever encoutered, I have 2 projects that's
Hey dudes.i am having this problem while symlinking. I have successfully deployed a ruby
Hey all, i have been trying for a few minutes on this problem and
hey everyone, here is the site SEE BELOW I have a slight jquery problem

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.