Rails 路由和表名的不规则变形器错误

Rails irregular Inflector errors with routing and tablename

我需要一个属模型,它应该复数化为属。我正在使用 Rails 4.2.1 与 Ruby 2.2.1 和 SQLServer 2014。我在 config/initializers/inflections.rb:

中添加了一个 Inflector
ActiveSupport::Inflector.inflections(:en) do |inflect|
  inflect.irregular 'genus', 'genera'
end

this question。我检查了 Rails 控制台,它正确地进行了单数化和复数化,当我 运行

rails generate scaffold Genus name:string

table 名称被正确地称为属,看起来事情是正确的。

但是,当我尝试实际查看视图时,出现错误。对于索引页面 (http://0.0.0.0:3000/genera),我在尝试访问 table 命名属时从数据库中收到错误消息:

TinyTds::Error: Invalid object name 'genus'.: EXEC sp_executesql N'SELECT [genus].* FROM [genus]'
Extracted source (around line #14):
12
13  <tbody>
14    <% @genera.each do |genus| %>
15      <tr>
16        <td><%= genus.name %></td>
17        <td><%= link_to 'Show', genus %></td>

对于新的 (http://0.0.0.0:3000/genera/new),我得到一个路径错误:

undefined method `genus_index_path' for #<#<Class:0x007fd9b9604380>:0x007fd993e8a2f0>
Extracted source (around line #1):                 
1 <%= form_for(@genus) do |f| %>
2   <% if @genus.errors.any? %>
3     <div id="error_explanation">
4       <h2><%= pluralize(@genus.errors.count, "error") %> prohibited this genus from being saved:</h2>
5 
6       <ul>

Trace of template inclusion: app/views/genera/new.html.erb

我显然做错了什么,但我找不到任何搜索此类错误的东西。除了添加那个 Inflector 之外,我还需要做其他事情吗?起初我以为这是 SQLServer 的错误,但这不会影响新视图中的路由,对吗?

问题原来是我忘记重启我的网络服务器了。显然 Web 服务器不会接收到对 Inflectors 的更改,但是当然只是 运行 rails 从命令行生成它确实看到了更改,所以...愚蠢的错误,但是如果其他人遇到过它,希望这对他们有所帮助。