Skip to content

Commit

Permalink
Work around mongoid empty in query
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurnn committed Dec 4, 2014
1 parent 2414c82 commit 5f6c665
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/notice.rb
Expand Up @@ -30,7 +30,11 @@ class Notice

scope :ordered, ->{ order_by(:created_at.asc) }
scope :reverse_ordered, ->{ order_by(:created_at.desc) }
scope :for_errs, lambda {|errs| where(:err_id.in => errs.all.map(&:id))}
scope :for_errs, Proc.new { |errs|
if (ids = errs.all.map(&:id)) && ids.present?
where(:err_id.in => ids)
end
}

def user_agent
agent_string = env_vars['HTTP_USER_AGENT']
Expand Down

0 comments on commit 5f6c665

Please sign in to comment.