Hi,
There are 3 models:
A has_many :Cs
B has_many :Cs
C belongs_to A and B
I got a single object of A and an array of B objects. How can I get
all Cs that have a_id equal to object A.id and b_id that belongs to
an object in Bs array?
Regards
Hi,
There are 3 models:
A has_many :Cs
B has_many :Cs
C belongs_to A and B
I got a single object of A and an array of B objects. How can I get
all Cs that have a_id equal to object A.id and b_id that belongs to
an object in Bs array?
Regards
On 4 Jul 2008, at 16:56, szimek wrote:
an object in Bs array?
C.find_all_by_a_id_and_b_id(A.id, [some_objects])
should work
Fred
On 4 Lip, 18:20, Frederick C. [email protected] wrote:
Regards
Thanks! I had no idea you can pass an array of AR objects to
find_by_something_id.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs