How to Properly Configure Rails 4.1 Enums in ActiveAdmin

后端 未结 3 670
日久生厌
日久生厌 2021-02-02 07:48

I\'ve got a Rails 4.1 app in which I use an enum to represent the privacy level of an object.

In my schema:

t.integer \"privacy_level\", default: 0
         


        
3条回答
  •  野的像风
    2021-02-02 08:18

    do this:

    f.input :privacy_level, :as => :select, :collection =>  privacy_level.keys.to_a
    

提交回复
热议问题