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

  • Home
  • SEARCH
  • 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 476111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:27:23+00:00 2026-05-13T00:27:23+00:00

This is probably quite simple but I haven’t yet been able to wrap my

  • 0

This is probably quite simple but I haven’t yet been able to wrap my head around the problem.

I have 3 tables… (well more than that) but in this scenario 3 that matter.

Places
Bookings and
Ratings

Places has_many bookings

Each booking has_one rating (because the user only rates once) and belongs_to (a) Place

Ratings belong_to (a) Booking

So even though bookings has only one rating, places has_many ratings through bookings as places has many bookings also

but this doesn’t seem to work? All the rest seem to.

Bookings has place_id and Ratings has a booking_id, and I’ve been successful with all other has_many through associations… just not the has_one? Any ideas? Thanks

addition: if i change Bookings to has_many :ratings it works… but bookings will only ever have one rating per booking… so this doesn’t seem like a good thing.

Invalid source reflection macro :has_one for has_many :ratings, :through => :bookings.  Use :source to specify the source reflection.
  • 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-13T00:27:23+00:00Added an answer on May 13, 2026 at 12:27 am

    has_many :through doesn’t work with has_one relations on the join model; see the following Rails tickets for details:

    • https://rails.lighthouseapp.com/projects/8994/tickets/1149
    • https://rails.lighthouseapp.com/projects/8994/tickets/2719-has_many-through-should-work-if-the-join-model-uses-has_one-relationship

    If possible, the best solution is probably to modify your relations so that a Booking belongs_to a Rating rather than has_one Rating.

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

Sidebar

Related Questions

I have a probably quite simple to solve problem. I'm trying to parse this
This is probably quite a simple problem, but it's causing me to scratch my
This is probably something extremely simple but I can't get my head around it
This is probably quite simple but I'm currently a git noob and haven't quite
This is probably quite a simple problem, but Im quite new to R. I
This is probably quite simple, but I just don't know how to do this...
This is probably a really simple question but one I've never quite worked out
This is probably quite simple but I've googled and can't find an answer. I
This is probably pretty simple but I'm not quite sure how to implement it.
This problem is probably very simple to solve but it is not clear to

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.