Polymorphic has_many through source problem

My issue is as follows:

I have a model with 2 polymorphic associations - authorisable and

In my current example, permissible represents an Account model and
authorisable is a User model

I need to be able to do find the users in an account by @account.users


has_many :permissions, :as => :permissible
has_many :users, :through => :permissions, :source => :authorisable

belongs_to :permissible, :polymorphic => true
belongs_to :authorisable, :polymorphic => true

The error I’m receiving is:
Cannot have a has_many :through association ‘Account#users’ on the
polymorphic object ‘Authorisable#authorisable’

I’m confused, can anybody help?

The error message says it all - it’s not currently possible to do a
has_many :through on a polymorphic association…

–Matt J.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs