Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninitialized constant PryStackExplorer::* when loading namespaced class #24

Open
delner opened this issue Apr 1, 2015 · 2 comments
Open

Comments

@delner
Copy link

delner commented Apr 1, 2015

I recently bumped a model of mine into a gem, which defines a class within a namespace as follows

module DE
  class Criteria
    ...
  end
end

I'm including this gem into my Rails 2 project, along with pry 0.10.1 and pry-stack_explorer 0.4.9.2. When I use my namespaced class in my car_critera.rb model as such:

class CarCriteria < DE::Criteria
  ...
end

On Rails application load, via console, I get the following load error, that seems to stem from pry-stack_explorer:

/Users/davidelner/.rvm/gems/ruby-1.9.3-p547@de-app/bundler/gems/rails-c51c00bb89b9/activesupport/lib/active_support/dependencies.rb:466:in `rescue in load_missing_constant': uninitialized constant PryStackExplorer::Criteria (NameError)

    from /Users/davidelner/.rvm/gems/ruby-1.9.3-p547@de-app/bundler/gems/rails-c51c00bb89b9/activesupport/lib/active_support/dependencies.rb:462:in `load_missing_constant'
    from /Users/davidelner/.rvm/gems/ruby-1.9.3-p547@de-app/bundler/gems/rails-c51c00bb89b9/activesupport/lib/active_support/dependencies.rb:106:in `const_missing_with_dependencies'
    from /Users/davidelner/src/de/app/models/car_criteria.rb:1:in `<top (required)>'

It doesn't seem to play well with namespaced models sourced from a gem? Do you have any ideas how to handle this?

@banister
Copy link
Member

banister commented Apr 1, 2015

wow that's really weird, seems like a bug in rails' constant lookup code though?

@delner
Copy link
Author

delner commented Apr 1, 2015

It could be: I had assumed PryStackExplorer may have injected some constant lookup stuff to ActiveSupport, but I might be mistaken in this regard. Disabling the stack explorer gem allows the app to run without problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants