MongoRecord has_one/has_many can't handle classes in modules

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      mongo-activerecord-ruby git version 0abf50167616ad627460e633539d321c520409ac
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When using MongoRecord a configuration such as "has_many :name, :class_name => 'Somemodule::Someclass'" will fail with the following error:

      /opt/local/lib/ruby/gems/1.8/gems/mongo_record-0.1.2/lib/mongo_record/base.rb:196:in `const_get': wrong constant name Somemodule::Someclass (NameError)
      from /opt/local/lib/ruby/gems/1.8/gems/mongo_record-0.1.2/lib/mongo_record/base.rb:196:in `has_many'
      from test_modules.rb:13

      This is because the Kernel.const_get call will not go any further than the top-level. You may wish to see http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/293822 for some discussion regarding the issue and some possible solutions .

            Assignee:
            Michael Dirolf (Inactive)
            Reporter:
            Stephen Haynes
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: