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

3.0.14 and has_and_belongs_to_many

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.15
    • Affects Version/s: None
    • Component/s: None

      Hi,

      I have a situation like this:

      class Topic
        include Mongoid::Document
      
        belongs_to :user
      
        attr_accessible :title
        field :title
      end
      
      class Conversation
        include Mongoid::Document
      
        has_and_belongs_to_many :users
      end
      
      class User
        include Mongoid::Document
      
        has_many :topics
        has_and_belongs_to_many :conversations
      
        attr_accessible :name
        field :name
      end
      
      user1 = User.create name: 'John'
      user2 = User.create name: 'Paul'
      topic = user2.topics.create(title: 'Music')
      user2.save
      
      conversation = Conversation.new
      conversation.users << user1
      conversation.users << topic.user
      

      mongoid 3.0.13 everything is fine

      mongoid 3.0.14:

      Unable to find source-code formatter for language: argumenterror. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      : wrong number of arguments (1 for 0)

      on the last line

      Unable to find source-code formatter for language: conversation. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      .users << topic.user
      ArgumentError: wrong number of arguments (1 for 0)
      	from /Users/cesidio/.rvm/gems/ruby-1.9.3-p286/gems/mongoid-3.0.14/lib/mongoid/relations/proxy.rb:49:in `reset_relation_criteria'
      	from /Users/cesidio/.rvm/gems/ruby-1.9.3-p286/gems/mongoid-3.0.14/lib/mongoid/relations/bindings/referenced/many_to_many.rb:24:in `block in bind_one'
      	from /Users/cesidio/.rvm/gems/ruby-1.9.3-p286/gems/mongoid-3.0.14/lib/mongoid/relations/binding.rb:38:in `block in binding'
      	from /Users/cesidio/.rvm/gems/ruby-1.9.3-p286/gems/mongoid-3.0.14/lib/mongoid/threaded/lifecycle.rb:55:in `_binding'
      	from /Users/cesidio/.rvm/gems/ruby-1.9.3-p286/gems/mongoid-3.0.14/lib/mongoid/relations/binding.rb:37:in `binding'
      	from /Users/cesidio/.rvm/gems/ruby-1.9.3-p286/gems/mongoid-3.0.14/lib/mongoid/relations/bindings/referenced/many_to_many.rb:20:in `bind_one'
      	from /Users/cesidio/.rvm/gems/ruby-1.9.3-p286/gems/mongoid-3.0.14/lib/mongoid/relations/proxy.rb:22:in `bind_one'
      	from /Users/cesidio/.rvm/gems/ruby-1.9.3-p286/gems/mongoid-3.0.14/lib/mongoid/relations/referenced/many_to_many.rb:208:in `append'
      	from /Users/cesidio/.rvm/gems/ruby-1.9.3-p286/gems/mongoid-3.0.14/lib/mongoid/relations/referenced/many_to_many.rb:31:in `<<'
      	from (irb):33
      	from /Users/cesidio/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
      	from /Users/cesidio/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
      	from /Users/cesidio/.rvm/gems/ruby-1.9.3-p286/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>'
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            tagliala tagliala
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: