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

Strange cache-like behaviour

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

      Hi.
      I just found strange behaviour in my mongoid application.

      class User
      include Mongoid::Document
      has_many :foos
      end

      class Foo
      include Mongoid::Document
      belongs_to :user
      field :name
      end

      And then in console:

      @user = User.first
      @foo = Foo.new
      @foo.name = "asd"
      @foo.user = @user
      @foo.save
      @user.foos
      => []
      @user = User.first
      @user.foos
      => [foo object]

      I'm not using any cache methods/gems etc. Is this normal behaviour?
      I'm using rails 3.1 stable, ruby 1.9.2p136, latest mongoid and bson_ext

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

              Created:
              Updated:
              Resolved: