samedi 11 avril 2015

Activerecord where condition with join for generic table prefix

I have 2 tables. I use table prefix x_.



  1. User has_many :follows (table x_users)

  2. Follow (table x_follows)


I want to find out total count after inner join. Following works fine.



User.joins(:follows).where(x_follows: {something: 1}).count


How can I remove x_ from where condition to make this call generic?


Aucun commentaire:

Enregistrer un commentaire