The solution is found here:

http://stackoverflow.com/questions/24607428/rubyonrails-counting-the-result-of-a-join

Basically, I need to specify in my :dicts model, that there is an 
association to :cards

# in class Dict:
has_many :idioms,  through: :cards

After this, I can do:

idioms.where(kind: kind).exists?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/ec99a75a5db0a6aba69f649ffbf01bba%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to