Piotr Solnica - 2011-04-28T07:39:28-07:00 - details
Regenerated gemspec for 1.1.1
Piotr Solnica - 2011-04-28T07:32:00-07:00 - details
Version bump to 1.1.1
rvm use @$(basename `pwd`) --create |
# Untested, mind dump | |
class Document < ActiveRecord::Base | |
include Virtus | |
before_save :dump_attributes | |
after_initialize :load_attributes | |
private |
# this is full of bad metaprogramming | |
class EmbeddedItems < DataMapper::Mongo::Property::Array | |
def load(value) | |
if value.nil? | |
nil | |
elsif value.is_a? ::Array | |
value.map { |item| embedded_item_class.load item }.extend collection | |
else | |
raise ArgumentError.new "+value+ of a property of #{self.class} type must be ::Array was: #{value.class}" | |
end |
Piotr Solnica - 2011-04-28T07:39:28-07:00 - details
Regenerated gemspec for 1.1.1
Piotr Solnica - 2011-04-28T07:32:00-07:00 - details
Version bump to 1.1.1
| AR 3.0.7 | DM 1.1.1 | SQ 3.22.0 | DIFF_AR_VS_DM | DIFF_SQ_VS_DM | | |
-------------------------------------------------------------------------------------------------------------------------- | |
Model#id x1000 | 0.004 | 0.000 | 0.000 | 13.79x | 0.64x | | |
Model.new (instantiation) x10 | 0.000 | 0.000 | 0.000 | 26.88x | 31.38x | | |
Model.new (setting attributes) x10 | 0.001 | 0.000 | 0.000 | 2.54x | 0.54x | | |
Model.get specific (not cached) x10 | 0.004 | 0.006 | 0.004 | 0.77x | 0.70x | | |
Model.get specific (cached) x10 | 0.004 | 0.001 | 0.004 | 5.70x | 4.77x | | |
Model.first x10 | 0.021 | 0.005 | 0.004 | 4.35x | 0.79x | | |
Model.all limit(100) |
Integration Model shared specs for Resource/EV:
Integration Resource shared specs for Resource/EV:
## | |
# | |
# The most important aspect of the new Property API is that | |
# property inheritance should not be used to instruct | |
# adapters how to persist data. It means, for example, that | |
# you should not use Integer as the base class for your custom | |
# property just because it is persisted as an integer. Right now | |
# Enum inherits from Integer because it is stored as an integer. | |
# It is a mistake, because a value of Enum property can be either | |
# a string or a symbol, not integer. The fact that it is persisted |
# Computes STI models who are grandchildren or more. | |
# | |
# In a STI the root class and its subclasses work normally, but if there are | |
# grandchildren we need to preload them. Reason is, given A < B < C, if you | |
# for example compute B.count without loading A, only B records are taken into | |
# account in the query (where a clause about the type column intervenes). This | |
# is not a bug, Active Record is simply not aware of A. Once it is, the clause | |
# becomes an OR with all relevant types. | |
# | |
# I used this script to compute them. |