# -*- encoding : utf-8 -*- class InterfaceBaseController < ActionController::Base private def set_version version = params[:version] || ‘1.8.0‘ ua = params[:ua] || ‘‘ @version = if ua == ‘xxx‘ ‘1.8.0‘ if version >= ‘2.1.0‘ elsif ua == ‘111‘ ‘1.8.0‘ if version >= ‘1.1.1‘ end @version ||= version end end
before_filter :set_version, only: [:all_channels] #可以直接使用@version来替代params[:version]
时间: 2024-10-14 06:06:37