You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
I wrote a custom datamapper property & defined load & dump methods but the value that I return is dependent on one of the resource's property, For example the model is say
classpersonpropertyamount,CustomTypepropertycurrency,StringendmoduleDataMapperclassPropertyclassCustomType < DataMapper::Property::Decimaldefdump(value)#If the user wanted to save 23.5 then I'd multiply the number with it's currency precision & store it in the databaseenddefload(value)# while retrieving i'll divide the value with the precision & give it to the userendendendend
The question is how can I get the currency attribute of the resource inside load/dump methods ?
The text was updated successfully, but these errors were encountered:
@mbj Basically you want me to modify the getters & setters right ? I tried that too but in that case If I do aggregates on the values I'll get a different result, is there a way we can override aggregates methods for this specific property of the model & let it return the calculated value instead of the aggregation of the values stored in the db ?
@mmuddasir Yeah, I pointed you to a workaround. Dunno aggregates where in the game! So I cannot point you to a better solution currently. I'm not deep inside dm-1, sorry.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I wrote a custom datamapper property & defined
load
&dump
methods but the value that I return is dependent on one of the resource's property, For example the model is sayThe question is how can I get the currency attribute of the resource inside load/dump methods ?
The text was updated successfully, but these errors were encountered: