Skip to content

NameError: uninitialized constant RecursiveOpenStruct in Rails 3.2.9? #4

@serv

Description

@serv

Now I have a method here that uses RecursiveOpenStruct.

def self.find(id)
  RecursiveOpenStruct.new(self.load(id))
end

self.load(id) is verified and it returns correct hash.

When I use find method, it returns

NameError (uninitialized constant Page::RecursiveOpenStruct):
  app/models/page.rb:29:in `find'
  app/controllers/us_controller.rb:10:in `start'

And when I try to use it in rails console,

1.9.3p194 :001 > RecursiveOpenStruct
NameError: uninitialized constant RecursiveOpenStruct
  from (irb):1
  from /Users/jkim/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
  from /Users/jkim/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
  from /Users/jkim/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'

My dev environment

  • Rails 3.2.9
  • ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.2]
  • Mac OS X 10.7.5

My gemfile includes
gem "recursive-open-struct", "~> 0.2.1"

gemfile.lock also includes
recursive-open-struct (0.2.1)

I did bundle install numerous times and it installed successfully

...
Using rails (3.2.9) 
Using recursive-open-struct (0.2.1) 
Using sass (3.2.3) 
Using sass-rails (3.2.5) 
Using uglifier (1.3.0) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions