lib/finapps/rest/operators.rb in finapps-5.0.3 vs lib/finapps/rest/operators.rb in finapps-5.0.4

- old
+ new

@@ -49,11 +49,13 @@ end private def validates(params) - params.key?(:password) && params[:password] && params.key?(:password_confirm) && params[:password_confirm] + params.key?(:password) && params[:password] && + params.key?(:password_confirm) && + params[:password_confirm] end def build_filter(params) filter = {} filter.merge!(search_query(params[:searchTerm])) if params[:searchTerm] @@ -64,10 +66,14 @@ def search_query(term) { "last_name": term } end def role_query(role) - role.is_a?(Array) ? { "role": { "$in": role.map(&:to_i) } } : { "role": role.to_i } + if role.is_a?(Array) + { "role": { "$in": role.map(&:to_i) } } + else + { "role": role.to_i } + end end end end end