-
-
Save wiecklabs/186777 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Address # Our custom, embedded-value type | |
orm.map_type do |signature, types| | |
signature.from [self] | |
signature.typecast_left method(:__load__) | |
signature.to [types.string, types.string, types.string, types.string, types.string] | |
signature.typecast_right method(:__dump__) | |
end | |
end | |
class Zoo | |
orm.map(self, "zoos") do |zoos, type| | |
zoos.field :id, type.serial | |
zoos.field :name, type.string(200) | |
zoos.embed :city, Address, type.string(200, "address_address_1"), | |
type.string(100, "address_address_2"), | |
type.string(100, "address_city"), | |
type.string(50, "address_state"), | |
type.string(50, "address_zip_code") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment