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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:36:14+00:00 2026-06-09T17:36:14+00:00

I have the following 3 models in my application: class Submission < ActiveRecord::Base has_many

  • 0

I have the following 3 models in my application:

class Submission < ActiveRecord::Base
 has_many :linkedsubmissions
end

class Linkedsubmission < ActiveRecord::Base
  belongs_to :submission
  has_many   :lnksubtypes
end


class Lnksubtype < ActiveRecord::Base
  belongs_to :linkedsubmission
end

In the code below ‘@submission.linkedsubmissions.lnksubtypes‘ is incorrect.

@history = Audit.find(:all, :conditions => ["auditable_id IN (?)",@submission.linkedsubmissions.lnksubtypes.map{|b| b.LSU_ID} ])

I need to find all audits with ‘auditable_id’ in @submission.linkedsubmissions.lnksubtypes

  • 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-09T17:36:16+00:00Added an answer on June 9, 2026 at 5:36 pm

    You need to add the following has_many relationship to your Submission model.

    class Submission < ActiveRecord::Base
     has_many :linkedsubmissions
     has_many :lnksubtypes, :through => :linkedsubmissions
    end
    

    Now, you’ll be able to reformat your query like this

    @history = Audit.find(:all, :conditions => ["auditable_id IN (?)", @submission.lnksubtypes.map(&:LSU_ID) ])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following models: class FieldEntryValue < ActiveRecord::Base belongs_to :field_entry end and class
I have the following models in my Rails application: class Shift < ActiveRecord::Base has_many
I have the following models: class Price < ActiveRecord::Base belongs_to :product end class Metric
I have the following models: class Person < ActiveRecord::Base has_many :accounts, :through => :account_holders
I have 2 models (Book & Image) class Book < ActiveRecord::Base has_many :images accepts_nested_attributes_for
I have following models setup in my Django application class School(models.Model): name = models.TextField()
I have the following models: class Foo has_and_belongs_to_many :bars end class Bar has_and_belongs_to_many :foos
I have the following models: class Application(models.Model): users = models.ManyToManyField(User, through='Permission') folder = models.ForeignKey(Folder)
I have a django model as following class Project(models.Model) name=models.CharField(max_length=200) class Application(models.Model) proj=models.ForeignKey(Project, null=True,
In a django application I have the following model: class Appointment(models.Model): #some other fields

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.