# model
# enumerizeがlocaleされている。
extend Enumerize
enumerize :account_type, in: { normal: 0, easy: 1, hard: 2, test: 3 },scope: true
# controller
@types = User.account_type.options
@types.map.with_index { |type, index| type[1] = index }
# view
<%= f.select :account_type_eq, @types %>
# model
extend Enumerize
enumerize :account_type, in: { normal: 0, easy: 1, hard: 2, test: 3 },scope: true
scope :search_by_type, -> (type) { where(type: type) }
# view
<%= f.label :search_by_type, 'タイプ:', class: 'col-md-2 control-label' %>
<%= f.select :search_by_type, User.type.options, {include_blank: true}, {class: 'form-control'} %>