【问题标题】:The gem simple_form displays numbers instead of associated stings, when using the enums introduced in Rails 4.1当使用 Rails 4.1 中引入的枚举时,gem simple_form 显示数字而不是关联的字符串
【发布时间】:2014-06-22 18:16:47
【问题描述】:

Rails 4.1 引入了enum,它不能很好地与最新版本的 simple_form 配合使用。当与关联一起使用时,simple_form 显示数字而不是关联的字符串。有什么解决办法或变通办法吗?

【问题讨论】:

    标签: ruby-on-rails-4 enums ruby-on-rails-4.1


    【解决方案1】:

    将以下行添加到您的 Gemfile

    # Help ActiveRecord::Enum feature to work fine with I18n and simple_form.
    gem 'enum_help'
    

    了解更多here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-22
      • 2017-10-07
      • 2011-01-04
      • 2015-12-18
      相关资源
      最近更新 更多