Inflection首字母缩略词效果不佳

时间:2014-06-24 14:36:56

标签: ruby-on-rails ruby acronym inflection

我在项目中使用inflections.acronym时遇到问题,因为它们的名称几乎相同

基本上,我有2个控制器:SEController和TSEController。它们完全不同。

我在我的变形中添加了以下几行:

ActiveSupport::Inflector.inflections do |inflect|
  inflect.acronym 'SE'
  inflect.acronym 'TSE'
end

当我尝试访问我的SEController时,它工作正常,但当我尝试访问我的TSEController时,它说:

Loading development environment (Rails 3.2.11)
irb(main):001:0> SEController
=> SEController
irb(main):002:0> TSEController
NameError: uninitialized constant TSEController
from (irb):2
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p327/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

如果我删除以下行,

inflect.acronym 'SE'

我的TSEController工作正常

Loading development environment (Rails 3.2.11)
irb(main):001:0> TSEController
=> TSEController

我该怎么办?

0 个答案:

没有答案