sailorproject / sailor

A Lua MVC Web Framework.
MIT License
921 stars 125 forks source link

Accessing a HAS_MANY relation fails if key is non-numeric #97

Closed louis77 closed 8 years ago

louis77 commented 8 years ago

According to https://github.com/sailorproject/sailor/blame/master/src/sailor/model.lua#L115 the SQL statement constructed doesn't quote the attribute value if it is a string.

This results in queries like: where canton = AG

Instead of using Model:find in the HAS_MANY branch the function Model:find_all_by_attributes should be used so the query will be constructed properly.