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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:56:42+00:00 2026-06-13T01:56:42+00:00

Right now I’m programming a plugin for the project managment app Redmine. And since

  • 0

Right now I’m programming a plugin for the project managment app Redmine.
And since I’m new to Rails, I have a question about a query.

Redmine provides me with an Issue model. In my plugin I’m defining an additional IssueRates model, which has the following associations:

class IssueRates < ActiveRecord::Base
unloadable

belongs_to :issue,
...

However, I don’t want to change the standard Issue model to have a has_one association, to keep the redmine code as clean as possible.

But now I need a query like this:

project_issues=Issue.where(:project_id => some_id)
project_issues.each do |i|
    puts i.IssueRates.amount
end

Which obviously doesn’t work, because of the missing association. Is there a way to reverse this association? Because then, I could even use eager loading with .includes(:IssueRates).

If this is not possible, I could still get the IssueRates in a separate query…

  • 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-13T01:56:44+00:00Added an answer on June 13, 2026 at 1:56 am

    I suppose you could do:

    IssueRates.find_by_issue_id(i.id).amount
    

    It seems like more work than just adding has_one to your Issue model.

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

Sidebar

Related Questions

Right now I'm using the jQuery selector $('foo+bar') . Since I already have $('foo')
Right now, I have developed an android app that is available free on the
Right now any new UIViewController added to my storyboard needs to have a class
Right now I have some TabItems in my App which are implicitly styled. I
Right now I have a database (about 2-3 GB) in PostgreSQL, which serves as
Right now I'm making an extremely simple website- about 5 pages. Question is if
Right now I have to create a new physical file in eclipse android for
Right now, I have two views that are using the users#create action: users/new.thml.erb and
Right now I have an upload field while uploads files to the server. The
Right now, I have: RewriteRule ^([^/\.]+)?$ index.php?id=$1 [L] to match any username at the

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.