ruby on rails - Query the associated table (without losing my hair) -



ruby on rails - Query the associated table (without losing my hair) -

ok, here's deal .. should simple, , i'm screwing sort of syntax somewhere:

i've got charge model has belongs_to relationship card.

i'd retrieve charges belong card name "john doe".

i've tried following, it's not working should (probably because i'm screwing syntax):

charge.where(card: [name: "john doe"])

help brother?

@floatingrock: seek this:

charge.joins(:card).where(cards: { name: 'john doe' })

as per requirment, first need bring together charge card , apply condition. hope works you.

ruby-on-rails rails-activerecord

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -