【问题标题】:Rails 1.2 "service is deprecated"Rails 1.2“服务已弃用”
【发布时间】:2009-01-07 21:39:53
【问题描述】:

我的应用在 Rails 1.2.6 上,我希望将其升级到 2.2 我在日志中看到了这个警告: 弃用警告:服务已弃用并将从 Rails 2.0 中删除,有关详细信息,请参阅http://www.rubyonrails.org/deprecation。 (从 .... application.rb:14 调用)

问题是 服务:通知

谁能告诉我服务是做什么的,因为我找不到这方面的任何文档。

【问题讨论】:

    标签: ruby-on-rails deprecated


    【解决方案1】:

    service 是一种指定控制器依赖关系的方法。依赖加载已移至 ActiveSupport。

    从 1.2.0 代码开始:

      # Specifies a variable number of services that this controller depends on. 
      # Services are normally singletons or factories, like
      # Action Mailer service or a Payment Gateway service.
      def service(*services)
        require_dependencies(:service, services)
        depend_on(:service, services)
      end
      deprecate :service
    

    【讨论】:

    • 所以我只需删除这一行,它会起作用还是我需要做一些额外的事情?
    • 我相信只要删除它就可以了。但是我不能做出任何承诺,如果没有看到更多你的代码。
    猜你喜欢
    • 2011-06-28
    • 2021-05-05
    • 1970-01-01
    • 2011-02-08
    • 1970-01-01
    • 2023-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多