My model has a string field (a short) and it stores it in db which is fine. But I want it always to return a symbol instead of string and, also, I'd like to assign a symbol to this string attribute. What I'm doing now doesn't work.
class MyModel < ActiveRecord::Base attr_accessible :attr1 def attr1 # self.try(:attr1).to_sym # how to return symbol? end def attr1= value # super.attr1.to_sym # doesn't work either endend
How do I reach this?