#34 ✓resolved
shm

"missing constant" exception when using namespaced models

Reported by shm | December 2nd, 2008 @ 09:52 AM

When i try to use "new_search" for a namespaced model, like


Admin::Post.new_search

i get the following error:


NameError: /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in `load_missing_constant': uninitialized constant Searchlogic::Cache::Admin

from **/vendor/plugins/searchlogic/lib/searchlogic/shared/virtual_classes.rb:21:in `create_virtual_class'

i fixed this by using "demodulize" for the model_class.name in "searchlogic/lib/searchlogic/shared/virtual_classes.rb:16":


def create_virtual_class(model_class)
  class_search_name = "::Searchlogic::Cache::#{model_class.name.demodulize}" + name.split(/::/)[1]

maybe you could test if this doesn't break other things. (tests run fine though)

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Provides common named scopes and object based searching.

People watching this ticket

Pages