How to store and compare :symbols in an ActiveRecord (Ruby on Rails)

后端 未结 7 1381
梦谈多话
梦谈多话 2021-02-05 04:51

I thought it would be good to populate a status field in an activeRecord table using constants. However, when it comes to checking if this status has a particular status, I\'m h

7条回答
  •  名媛妹妹
    2021-02-05 05:08

    Also you can overwrite the reader method:

    def status
      read_attribute(:status).to_sym
    end
    

提交回复
热议问题