module Blackbeard::StorableAttributes::InstanceMethods
Public Instance Methods
attributes_hash_key()
click to toggle source
# File lib/blackbeard/storable_attributes.rb, line 94 def attributes_hash_key "#{key}::attributes" end
reload_storable_attributes()
click to toggle source
# File lib/blackbeard/storable_attributes.rb, line 85 def reload_storable_attributes @storable_attributes = nil @storable_attributes_dirty = false end
save_storable_attributes()
click to toggle source
# File lib/blackbeard/storable_attributes.rb, line 77 def save_storable_attributes raise StorableNotSaved if new_record? if @storable_attributes_dirty db.hash_multi_set(attributes_hash_key, storable_attributes_hash) @storable_attributes_dirty = false end end
storable_attributes_hash()
click to toggle source
# File lib/blackbeard/storable_attributes.rb, line 90 def storable_attributes_hash @storable_attributes ||= db.hash_get_all(attributes_hash_key) end
update_attributes(tainted_params)
click to toggle source
# File lib/blackbeard/storable_attributes.rb, line 68 def update_attributes(tainted_params) attributes = self.class.storable_attributes safe_attributes = tainted_params.keys.select{ |k| attributes.include?(k.to_sym) } safe_attributes.each do |attribute| self.send("#{attribute}=".to_sym, tainted_params[attribute]) end save_storable_attributes end