带有DEPRECATION的subdomain_routes gem警告:不推荐使用Kernel#returns而使用Object#tap

时间:2012-02-18 18:51:05

标签: ruby-on-rails rubygems subdomain

我们使用subdomain_routes(0.3.1),现在我们从rails 2.3.8到rails 2.3.14时看到了这个弃用警告:

DEPRECATION WARNING: Kernel#returning has been deprecated in favor of Object#tap. (called from significant_keys_with_subdomains at /home/mei/.rvm/gems/ruby-1.9.2-p0@rails2314/gems/subdomain_routes-0.3.1/lib/subdomain_routes/routes.rb:75)

有关如何解决此问题的任何想法?

BTW,这是significant_keys_with_subdomains的代码:

def significant_keys_with_subdomains
  returning significant_keys_without_subdomains do |result|
    if conditions[:subdomains].is_a? Symbol
      result << conditions[:subdomains]
      result.uniq!
    end
  end
end

1 个答案:

答案 0 :(得分:1)

您可以使用其中一个修复它的现有分支,也可以创建自己的分支并执行此人的操作:https://github.com/mataki/subdomain_routes/commit/aed6b45d0e98531bdd4201e8f076bf49a34eadf8?w=1