class Rtml::State < ActiveRecord::Base serialize :other_data, HashWithIndifferentAccess set_table_name 'rtml_states' validates_presence_of :model validates_uniqueness_of :itid def after_initialize self.other_data ||= {}.with_indifferent_access end def [](key) return self.send(key) if attributes.keys.include?(key) other_data[key] end def []=(key, value) return self.send("#{key}=", value) if attributes.keys.include?(key) other_data[key] = value end end