2

I have the follow model using enumerize gem:

class Event < ActiveRecord::Base
    extend Enumerize
    enumerize :code, in: {dummy: 0, none: 1, panic: 2 }
end

This rabl file returns the strings "dummy", "none" and "panic:

object @event
attributes :code, :address...

And I need to return the integer values of :code.

Ricardo
  • 667
  • 9
  • 25

1 Answers1

2

Looking at the Enumerize readme on github it states that using .code_value gets the value of the enumeration while .code simply returns the name of the enumeration. That being said, I am not familiar with rabl or its conventions, though if I were simply to guess, try :code_value.

Let me know how it works, sorry if this is of no help.

Vasseurth
  • 6,354
  • 12
  • 53
  • 81