jagi / meteor-astronomy-timestamp-behavior

https://atmospherejs.com/jagi/astronomy-timestamp-behavior
MIT License
5 stars 6 forks source link

Add ability to set default field names globally #3

Closed vladshcherbin closed 9 years ago

vladshcherbin commented 9 years ago

Now, we can add the timestamp behaviour and specify, how the fields are named in the class. But is there a way to specify the names globally? For example, to use created_at and updated_at everywhere, where this behaviour is used.

lukejagodzinski commented 9 years ago

It probably is possible but I wouldn't recommend it :-). You would have to override default behavior options.

Astro.behaviors.timestamp.options.createdFieldName = 'created_at';
vladshcherbin commented 9 years ago

@jagi thanks for a possible workaround ;) so what would you recommend to do in such case?

lukejagodzinski commented 9 years ago

Hmm right now I think you can use this approach :). Just make sure that you change the options before any class definition.

vladshcherbin commented 9 years ago

Thanks, @jagi . I guess, I'll use class definition for now. Maybe later you will add a better way.