Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5830

Passing proc options to store_in raises NoMethodError

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 9.1.0, 9.0.4
    • Affects Version/s: 9.0.0, 9.0.1, 9.0.2, 9.0.3
    • Component/s: None
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      The issue first highlighted MONGOID-5813, which was closed as supposedly fixed with MONGOID-5819, is still present.

      Using the minimal reproduction code I supplied in the first issue still raises the same error:

      require "bundler/inline"
      
      gemfile do
        source "https://rubygems.org"
      
        # Include desired version when testing
        # gem "mongoid", "~> 8.0"
        gem "mongoid", "~> 9.0.3"
      end
      
      Mongoid.configure do |config|
        config.clients.default = {
          hosts: ["localhost:27017"],
          database: "foo",
        }
      end
      
      class Foo
        include Mongoid::Document
      
        store_in database: ->{ "foo" }, client: ->{ :bar }
      end
      
      puts "Mongoid: #{Mongoid::VERSION}"
      puts Foo.create
      # => undefined method `to_sym' for an instance of Proc (NoMethodError) name_as_symbol = name.to_sym
      

            Assignee:
            jamis.buck@mongodb.com Jamis Buck
            Reporter:
            asgerb Asger Behncke Jacobsen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None