Rails 1.2 “service is deprecated”
-
05-07-2019 - |
Question
My app is on rails 1.2.6 and I wish to upgrade it to 2.2 I see this warning in the logs: DEPRECATION WARNING: service is deprecated and will be removed from Rails 2.0 See http://www.rubyonrails.org/deprecation for details. (called from .... application.rb:14)
The line is question is service :notification
Can somebody tell me what service does as I can't find any documentation on this.
Solution
service
was a way of specifying controller dependencies. Dependency loading got moved into ActiveSupport.
From the 1.2.0 code:
# 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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow