Created
November 15, 2010 10:57
-
-
Save txus/700258 to your computer and use it in GitHub Desktop.
Apparently AR doesn't really save the serialized aggregation, although the model seems to be perfectly aware of it.
This file contains 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 Prizes < Struct.new(:c1,:c2) | |
end | |
class Draw < ActiveRecord::Base | |
composed_of :prizes, :mapping => Prizes.members | |
end | |
draw = Draw.new | |
p Draw.column_names.include? "prizes" | |
# => true | |
draw.prizes = Prizes.new(1,2) | |
draw.save! | |
p draw.prizes | |
# => #<struct Prizes c1=1, c2=2> | |
p draw[:prizes] | |
# => nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment