anykeyh / clear

Advanced ORM between postgreSQL and Crystal
https://github.com/anykeyh/clear
MIT License
269 stars 34 forks source link

Fix JSON::Deserialize not working with column_name field #203

Open dukeraphaelng opened 3 years ago

dukeraphaelng commented 3 years ago

Description

https://github.com/anykeyh/clear/blob/3bdaa44a7d0382fd8f6846afe8b8da95d58d9452/src/clear/model/modules/has_columns.cr#L174

The key is assigned to the method name, name.var by default but will be re-assigned to column_name.id if declared, which is the name of the column in the database, not the name of the method.

We need to use the method name and not the column_name, hence the change from {{name.id}} to {{settings["crystal_variable_name"]}}

Motivation and Context

How Has This Been Tested?

Types of changes

Checklist: