Sha256: 23921ee0ee88e2e26e0376e312a0e524812932ce0c6ee8fe047a9771b221de36

Contents?: true

Size: 500 Bytes

Versions: 5

Compression:

Stored size: 500 Bytes

Contents

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rtml-2.0.4 builtin/models/rtml/state.rb
rtml-2.0.3 builtin/models/rtml/state.rb
rtml-2.0.2 builtin/models/rtml/state.rb
rtml-2.0.1 builtin/models/rtml/state.rb
rtml-2.0.0.alpha.1 builtin/models/rtml/state.rb