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

Touch and models without timestamps

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

      Hi,

      I have the following issue with mongoid 3.0.17:

      class Book
        include Mongoid::Document
        attr_accessible :title
        field :title
      end
      
      book = Book.create title: 'Cloud Atlas'
      book.respond_to? :touch
      book.touch
      book.reload
      book.title
      

      book responds to touch and book.touch returns true, but after reloading its

      Unable to find source-code formatter for language: title```. 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
       is 

      nil

      
      

      ruby
      class BookWithTimestamps
      include Mongoid::Document
      include Mongoid::Timestamps
      attr_accessible :title
      field :title
      end

      book_with_timestamps = BookWithTimestamps.create title: 'Cloud Atlas'
      book_with_timestamps.respond_to? :touch
      book_with_timestamps.touch
      book_with_timestamps.reload
      book_with_timestamps.title
      `

      Everything is fine when the model has timestamps.

      I don't know if it's a bug or not, but I found this strange behaviour and reported it.

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

              Created:
              Updated:
              Resolved: