How does one access this hash from an ActiveRecord class in the Rails console?

Posted by randombits on Stack Overflow See other posts from Stack Overflow or by randombits
Published on 2010-05-30T02:43:37Z Indexed on 2010/05/30 2:52 UTC
Read the original article Hit count: 193

Filed under:
|

I have a simple hash I created to make it easier to do dictionary type lookups. For instance:

class Numbers < ActiveRecord::Base

   MY_TYPES {
      one: => 1,
      two: => 2
   }

end

Is it not possible in the rails console to access this hash via Numbers.MY_TYPES[:one]?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby