Replaced control flow operators with logical operators

pull/599/head
Sebastian Schuster 11 years ago
parent 7d997303dc
commit 98c335102a
  1. 9
      app/models/query.rb

@ -115,10 +115,11 @@ class Query < ActiveRecord::Base
return unless filters
filters.each_key do |field|
unless # filter requires one or more values
(values_for(field) and values_for(field).first.present?) or
# filter doesn't require any value
["o", "c", "!*", "*", "t", "w"].include? operator_for(field)
unless \
# filter requires one or more values
(values_for(field) && values_for(field).first.present?) \
|| ["o", "c", "!*", "*", "t", "w"].include?(operator_for(field))
# filter doesn't require any value
errors.add :base, errors.full_message(WorkPackage.human_attribute_name(field),
I18n.t('activerecord.errors.messages.invalid'))
end

Loading…
Cancel
Save