Skip to content

Instantly share code, notes, and snippets.

@paul
Created October 6, 2008 21:09
Show Gist options
  • Save paul/15144 to your computer and use it in GitHub Desktop.
Save paul/15144 to your computer and use it in GitHub Desktop.
class PostgresAdapter
def translate_attribute(attribute)
case attribute
when Numeric
attribute.value
when String
quote_string(attribute.value)
when Array
attribute.value.map { |v| translate_attribute(v) }.join(',')
when attribute.value.respond_to?(dm_serialize)
attribute.value.respond_to?(dm_serialize(adapter))
else
quote_string(attribute.to_s)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment