Module: ActiveRecord::Has::SparseAttributes::InstanceMethods

Defined in:
lib/active_record/has/sparse_attributes.rb

Instance Method Summary collapse

Instance Method Details

#get_sparse_attribute(name) ⇒ Object



85
86
87
# File 'lib/active_record/has/sparse_attributes.rb', line 85

def get_sparse_attribute(name)
	self.get_sparse_attribute_storage(name).get(name)
end

#get_sparse_attributesObject



76
77
78
79
80
81
82
83
# File 'lib/active_record/has/sparse_attributes.rb', line 76

def get_sparse_attributes()
	r = {}
	self.class.sparse_attributes.each_key do |k|
		v = self.get_sparse_attribute(k)
		r[k] = v unless v.nil?
	end
	return r
end

#set_sparse_attribute(name, value) ⇒ Object



89
90
91
# File 'lib/active_record/has/sparse_attributes.rb', line 89

def set_sparse_attribute(name, value)
	self.get_sparse_attribute_storage(name).set(name, value)
end