revel / modules

Officially supported Revel modules
http://revel.github.io/modules/
MIT License
49 stars 46 forks source link

[orm/gorm] Allow configuration of singulartable #64

Closed almarto closed 6 years ago

almarto commented 6 years ago

I'm using DB.SingularTable(true) but I have to use this code within every function of my controllers. I didn't find a general place to set this value and I'd expect it to be configurable using the app.conf file.

Would it be possible to add a new configuration attribute? e.g. 'db.singulartable', so there is a general and unique place where this can be configured.

notzippy commented 6 years ago

A good place to set that would be in the

revel.AppStart(func(){
gorm.DB.SingularTable(true)
})

But configurable is fine as well

almarto commented 6 years ago

Yes @notzippy, it would be a good place but if use that code there, people who don't want/need to use SingularTable will have to use DB.SingularTable(false) within every function in their controllers.

almarto commented 6 years ago

Could you @notzippy please check the PR #66? I guess that would be a good solution to add for the next release.

notzippy commented 6 years ago

Merged in develop