RubyMoney/money-rails

find_or_create_by doesn't work if passing money attributes

Closed this issue · 1 comments

For example: https://github.com/wvchallenges/se-challenge-expenses/pull/76/files/4370199dbdec6b52e36f3c4921a60eb721f1f671#diff-505a500036112ed3fd25ecd58626183655a4ff626c8bc1dd3cce9fc67af92516R26

If you have an attribute that is a monetize attribute, methods like create and update work and you can pass values directly for that attribute, but find_or_create_by doesn't work

I ran into something similar today. You cannot use money objects in where conditions. This came as a surprise to me as it should be supported by serializers automatically. However, looking at the code, that isn't how money-rails ties into Rails. My guess is because Money uses two fields which isn't supported by serializers.