【发布时间】:2016-09-08 18:13:24
【问题描述】:
我有一个简单的枚举(在 Rails 4.something 中添加)
enum direction_type: [:undefined, :loop, :out_and_back, :point_to_point]
这可行,但在日志中我看到了这个错误:
Creating scope :loop. Overwriting existing method Trail.loop.
另一个:
enum status: [:undefined, :new, :draft, :published]
Creating scope :new. Overwriting existing method Trail.new.
我不完全确定这些错误的含义,但它们听起来不太好!
我应该更改这些枚举还是有其他解决方案(比如我可以添加一些巧妙的范围规则来修复它们?)
【问题讨论】:
标签: ruby-on-rails enums