Open p-gw opened 3 years ago
Hallo Phillip Which adapter for storing your data you use? Some things are regulated within the adapter so it is important for a fast solution to know which one you use. Edit: I see in the stacktrace you use the PostgeSQL-adapter. Best Frank
I've tried it with both the PostgreSQL adapter and the SQLite adapter with the same result.
It doesn't matter which one for solving this problem. Only when you have a problem with a task in one ore the other adapter for production purposes it should be the right adapter to begin with. :-)
@Adrian, @Phillip There are two different approaches for dealing with functions such as before_save, after_save and so on. First: The implementation like it is done for now in SearchLight by using a field in the model struct and dealing then with them. Second: We could implement this functions as a generic function, prepare fallback functions for this and let the user of SearchLIght choose whether he/she implement these functions for the type in the model. For now I defined the fields which are reserved for this actions in an array and filter them on the right place. You will find the corresponding source file of src/SearchLight.jl attached to this comment.
Feel free to contact me any time if you have comments, wishes or hints.
Best Frank P.S. I also removed an error from the save! chain.
I think the callbacks API needs to be updated.
Describe the bug If callback fields are specified in the model, entries cannot be saved to the database. The
save!
function expects the callback fields of the struct as columns in the database table.Error stacktrace
To reproduce
Create a model containing callbacks, e.g.
Save entry to database
This will result in the above
UndefinedColumn
error.Expected behavior The expected behaviour is to ignore the callback fields (
before_save
andafter_save
) of thestruct
when creating entries in the database.