Need a good way to set geddy.model.useTimestamps before models are created #104

david-mitchell opened this Issue Mar 13, 2012 · 6 comments


None yet

2 participants


From what I can tell, geddy.model.useTimestamps is meant to be a sort of global configuration flag, but there don't seem to be any files parsed before the models, so the only way to make sure that it's always true is to either fork the project and change it or set the flag in each of my models.

If I'm incorrect in my understanding, some sort of mention of this in the tutorial or documentation would be most helpful.


Actually, your init.js file in the config directory runs dead-last, so you can set that option there as a workaround. But yes, this should be an obvious, settable config option in your environment files. This will be pretty easy to fix.


Okay, this is fixed in master. Just add a section like this to your config file (environment.js, development.js, whatever):

, model: {
useTimestamps: false
, forceCamel: true

The values will override the defaults in geddy.model.

Let me know if this works for you.

Worth noting that the useTimestamps codepaths haven't been tested at all since the major refactor to 0.2. Please let me know if it's behaving as expected.

Thanks. :)


Sorry, I should have been a bit more specific. geddy.model.useTimestamps is set to false by default, and the model registration code runs differently when this is the case—if true, then the timestamp properties are registered.

I want timestamps to be fully enabled—and they seem to work well enough—but the only way to make sure that the properties are added to my models is to set the flag prior to registering my model. Unless I missed something (not unlikely), even the environment files are run after the models.


The environment settings are loaded in the master process, before anything else, and passed to the workers, and they're applied to geddy.model before the registrations, so this should do what you want.


Yes, it works great. Thanks.


Excellent. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment