module BelongsToHstore::Association

Public Instance Methods

read_attribute(attr_name) click to toggle source
Calls superclass method
# File lib/belongs_to_hstore/association.rb, line 36
def read_attribute(attr_name)
  if attr_type = self.class.belongs_to_hstore_attributes[attr_name]
    attr_value = send(attr_name)
    if attr_type == Integer
      attr_value = (attr_value.is_a?(String) && attr_value.empty?) ? nil : attr_value.to_i
    end
    attr_value
  else
    super
  end
end
write_attribute(attr_name, attr_value) click to toggle source
Calls superclass method
# File lib/belongs_to_hstore/association.rb, line 48
def write_attribute(attr_name, attr_value)
  if self.class.belongs_to_hstore_attributes[attr_name]
    send("#{attr_name}=", attr_value.to_s)
  else
    super
  end
end