byroot/activerecord-typedstore

Misleading description

sheerun opened this issue · 4 comments

Unfortunately this gem doesn't behave exactly like ActiveRecord::Store. For example it delegates method from typed hash to model. It should create typed accessors on hash instead. In case of ActiveRecord::Store the :accessors option is required to enable such feature.

I don't agree, the point of ActiveRecord::Store is to be freed from hash based APIs.

ActiveRecord::Store without accessors is nothing more than a good old serialize.

I cannot use it in my project because of name clashes between attributes in serialized fields. For example:

store :billing_address
store :delivery_address

where both fields have the same attributes.

In case of ActiveRecord::Store there was no problem, because all fields were enclosed. In case of your gem attribute names are delegated to model. Concluding, I cannot use your gem the same way as ActiveRecord::Store, so it's not fair to call it "behaving the same" :)

I get your point. Note that for now, you can just not define the clashing names, you won't benefit from typecasting for these ones, but you will be able to store them just like with ActiveRecord::Store.

I'll see what I can do for you.

@sheerun would you mind checking the typed-hash branch ?

I think it should solve your issue.
In any case, your feedback would be much appreciated.