开发者

rails 3 model name conflict

开发者 https://www.devze.com 2023-02-19 05:45 出处:网络
i开发者_JAVA技巧 have a model called Job. In ruby core there is a module Benchmark and class within it Job.

i开发者_JAVA技巧 have a model called Job. In ruby core there is a module Benchmark and class within it Job.

That's make the conflict when i try to call Job.all.

Is there any possible and safe solution to resolve this without to rename my model?

Big thanks


Renaming your model is the safest way, but you can try with namespaces:

module MyModule
   class Job < ActiveRecord::Base
   end
end
0

精彩评论

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

关注公众号