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

Origin 2.2.1. brought up a strange bug

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • origin-2.2.2
    • Affects Version/s: origin-2.2.1
    • Component/s: None
    • Environment:
      ruby 2.3, rails 4.2, kaminari 0.17.0, mongoid 5.1.5.

      This line is giving me a really strange error message:
      @borza = Borza.where(:created_at.gt => 6.months.ago ).order_by(created_at: -1).page(params[:page]).per(3)

      Completed 500 Internal Server Error in 19ms

      NoMethodError (undefined method `|' for 2016-04-20 07:52:18 UTC:Time):
      app/controllers/borza_controller.rb:42:in `index'

      Rendered vendor/ruby/2.3.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/templates/rescues/_source.erb (18.1ms)
      Rendered vendor/ruby/2.3.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (8.1ms)
      Rendered vendor/ruby/2.3.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (5.3ms)
      Rendered vendor/ruby/2.3.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (58.5ms)

      The error doesn't appear if I remove pagination:
      @borza = Borza.where(:created_at.gt => 6.months.ago ).order_by(created_at: -1)

      The error also doesn't appear if I remove where:
      @borza = Borza.all.order_by(created_at: -1).page(params[:page]).per(3)

      The error seams to appear only on this collection so I am also attaching model definition.

      The solution is to force origin version 2.2.0.

      by
      TheR

        1. borza.rb
          5 kB
          Damjan Rems

            Assignee:
            Unassigned Unassigned
            Reporter:
            d_rems@yahoo.com Damjan Rems
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: