Cannot access an ActiveResource model through a polymorphic association #3556

sidonath opened this Issue Nov 7, 2011 · 1 comment


None yet
2 participants

sidonath commented Nov 7, 2011


When trying to access an ActiveResource model through the polymorphic association (belongs_to), the following exception is thrown:

undefined method `scoped' for Employee:Class

where Employee < ActiveResource::Base

This is a regression from Rails 3.0. More details in the example repo.

Isolated example

There is a repo with an isolated example of the problem. The example schema is based on the guide to Active Record Associations.

Known workaround

Access the active resource directly (eg. Employee.find(picture.imageable_id)).


jeremy commented Apr 12, 2012

Interesting! Didn't know that ever worked. It's definitely unintentional; polymorphic associations are only meant to work with Active Record models.

Would be pretty cool to make this work again, though!

@jeremy jeremy closed this Apr 12, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment