Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

How do I do a search through associations? #26

Open
angelacode opened this issue Jun 2, 2011 · 2 comments
Open

How do I do a search through associations? #26

angelacode opened this issue Jun 2, 2011 · 2 comments

Comments

@angelacode
Copy link

Here is what I tried:

http://stackoverflow.com/questions/6207545/how-do-i-search-through-associations-in-metawhere-in-rails-3

I read the following documentation and tried to follow it:

http://metautonomo.us/projects/metawhere/

Thanks! Just trying to make the translation of everything in my app....

@angelacode
Copy link
Author

Here>is the error I get from Console:

  irb(main):002:0> Todo.joins(:contacts).where(:contacts => {:campaign_id => 1}).to_sql

NameError: undefined local variable or method `association' for #<ActiveRecord::Associations::ClassMethods::JoinDependency:0xb5433a54

@franciscoj
Copy link

Maybe something like that can fix your problem:

Todo.joins(:contacts).where(:contacts => [:campaign_id >> 1])

Disclaimer: I use MetaWhere.operator_overload!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants