开发者

Backwards-compatible solution for "rails/init.rb is deprecated"?

A Rails plugin I use (google_analytics) that was written for Rails 2.3 contains a file called rails/init.rb, which under Rails 3 yields the warning:

DEPRECATION WARNING: Use toplevel init.rb; rails/init.rb is deprecated: /home/logankoester/hack/active/myapp/vendor/plugins/google_analytics/rails/init.rb. (called from <top (required)> at /home/logankoester/hack/active/myapp/config/environment.rb:5)

Now, I could simply move the file in my fork, but I don't expect this would be backwards-compatible with Rails 2. Is there a solution to this change that w开发者_如何学编程ould work for both versions, or will I have to maintain separate branches for each major version of Rails?


Try to rewrite it to a gem and bundle it. That would work for Rails 2 as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜