Automatic converting old syntax of scopes to new one

65 Views Asked by At

I'm working on upgrade of old code which contains a lot of deprecated code in scopes. For example:

scope :by_domain, lambda { |domain| {:joins => :profile_domains,
                                     :conditions => ["profile_domains.domain_id = ?", domain] }

It should be changed to:

scope :by_domain, ->(domain) { joins(:profile_domains).
                               where("profile_domains.domain_id = ?", domain) }

Is there some solution that automatically converts the old syntax to a new one or developers every time correct it manually?

0

There are 0 best solutions below