pry / pry-stack_explorer

Walk the stack in a Pry session

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`uninitialized constant PryStackExplorer::*` when loading namespaced class

delner opened this issue · comments

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?

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

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.