Fixed epp_session

This commit is contained in:
Priit Tamboom 2014-10-13 11:25:53 +03:00
parent ee2d93128c
commit cc667efcb1

View file

@ -1,9 +1,13 @@
class EppSession < ActiveRecord::Base class EppSession < ActiveRecord::Base
before_save :marshal_data! before_save :marshal_data!
# rubocop: disable Rails/ReadWriteAttribute
# Turned back to read_attribute, thus in Rails 4
# there is differences between self[:data] and read_attribute.
def data def data
@data ||= self.class.unmarshal(self[:data]) || {} @data ||= self.class.unmarshal(read_attribute(:data)) || {}
end end
# rubocop: enable Rails/ReadWriteAttribute
def [](key) def [](key)
data[key.to_sym] data[key.to_sym]