未初始化常量-无法访问rails lib文件中的哈希

jjhzyzn0  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(190)

我的电脑中有以下文件 lib 文件夹

class Features
  @@version_code = nil
  @@additional_features = nil
  @@custom_version = nil

  @@enabled_feature_codes = []

  DEFAULT_VERSION_CODE = 'ACC'

  FEATURES = {
    'SCH' => { :name => 'Scheduling', :depends => ['WOS'] },
    'REQ' => { :name => 'Requirements Planning' },
    'WOS' => { :name => 'Works Orders' },
    'BOM' => { :name => 'BoM' },
    'QAS' => { :name => 'Quality Assurance' },
    'SNO' => { :name => 'Serial Numbering' },
    'CON' => { :name => 'Contracts' },
    'PAC' => { :name => 'Payment Certificates', :depends => ['CON'] },
    'REP' => { :name => 'Repairs and Client Inventory', :depends => ['WOS'] },
    'DPR' => { :name => 'GDPR Pack' },
    'API' => { :name => 'API' }
  }
end

我这里的问题是,我正在尝试访问中的api标志 FEATURES 通过使用以下命令。

<% if Features.API? %>
 <a class="tab-button" data-id="web_api">Web API</a>
<% end %>

我得到的错误如下

uninitialized constant #<Class:0x0000556bf5ff6ed0>::Features'

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题