Search code examples
ruby-on-railsruby-on-rails-4mongoidsyntax-errormongoid4

syntax error, unexpected keyword_or scope


I'm running Feed.history but It's raising the error above at the title because of the scope line I use in Feed model:

scope :history, -> { or({:end.ne => nil}, {:end.lt => Time.current}) }

what and why?!!


Solution

  • Try this

    scope :history, where('$or' => [{:end.ne => nil}, {:end.lt => Time.current}])