I need to run a rake task to migrate data in my model
class Translation < ApplicationRecord
store :body, accessors: [:object_body], coder: YAML
belongs_to :team
end
and need to access body
as text.
I don't want to remove the coder part since a lot of logic relies on that.
Can I access body
without decoding to a ruby object?
Just add a new method on the model.
class Translation < ApplicationRecord
store :body, accessors: [:object_body], coder: YAML
belongs_to :team
def raw_body
read_attribute_before_type_cast('body')
end
end