binarylogic / searchlogic

Searchlogic provides object based searching, common named scopes, and other useful tools.
http://rdoc.info/projects/binarylogic/searchlogic
MIT License
1.4k stars 133 forks source link

Fix NameError when ordering using polymorphic association #134

Closed nandalopes closed 13 years ago

nandalopes commented 13 years ago

In my application I have the following models:

User.belongs_to :profile, :polymorphic => true
Empresa.has_many :users, :as => :profile

When I tried to do the sorting through the polymorphic association, resulted in an error because the sorting method was not taking into account the type of association.

User.ascend_by_profile_empresa_type_nome.proxy_options

I get the following error:

> NameError: uninitialized constant User::Profile
nandalopes commented 13 years ago

I tried to include a test to verify the bug, but I'm having trouble running the tests. When I try to use the rake for this, see the following error:

> no such file to load -- spec/rake/spectask
ghost commented 13 years ago

Sorry for the delay, great fix. Pulled in an added to the next version.