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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:48:10+00:00 2026-06-12T01:48:10+00:00

I imported a db schema and its content from a legacy site into a

  • 0

I imported a db schema and its content from a legacy site into a Rails project.

I have DVDs and votes. Votes are simply an integer field in Dvd model like Dvd.votes:integer=10.

Since I can also associate new votes to users easily in Rails, I created a new Vote model that belongs to Dvd and User models.

My situation is that now when calling Dvd.first.votes I get an empty array [] since there’s no data yet on the Vote model but the votes_count still has the imported counts.

(I also renamed the Dvd.votes field to Dvd.votes_count after adding the Vote model and added belongs_to :dvd, :counter_cache => true on Vote model.)

I’m not sure what would be the ideal solution to this problem. Should I call votes by simply querying Dvd.votes_count or there’s a better way to do it?

  • 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-12T01:48:11+00:00Added an answer on June 12, 2026 at 1:48 am

    Sorry, it might be not an answer for your question, but instead of creating your own solution I recommend to use gem: https://github.com/bouchard/thumbs_up
    which already optimized. In your situation it may save a lot of time.
    So you need to install gem and then import existing votes to it.

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

Sidebar

Related Questions

I have imported a JSF/Facelets project from SVN into Netbeans. Any change which I
I have created two wsdl files with shared types imported from xsd schema file.
I have two schema files one is imported from the other. When executing the
I have a MS SQL imported into SQL Server 2008 from a .bak and
I imported some data into my schema and I have one sequence for all
I imported LuaInterface into a console project, referenced it, and wrote a small test
I imported system.web into my class lib project. Trying to find: system.web.httpserverutility.server.mappath But I
Having imported an existing GWT project into Eclipse, the WEB-INF/lib directory was empty and
So I have imported a project to netbeans. I am using jsf and xhtml
I'm having troubles keeping classes from being regenerated. I'm I have a schema A,

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.