jphorta
jphorta

Reputation: 2174

ActiveRecord cache_timestamp_format configuration not being applied

I'm trying to change the migration version timestamp format by setting this configuration config.active_record.cache_timestamp_format = :nsec in the application.rb or in development.rb, like it is said here http://guides.rubyonrails.org/configuring.html#configuring-active-record.

The problem is that this configuration is being ignored, regardless of the format I set there, when I generate a new migration, the timestamp format stays the same.

Am I doing something wrong here?

Upvotes: 4

Views: 305

Answers (1)

Afonso Tsukamoto
Afonso Tsukamoto

Reputation: 1214

Because apparently rails migration is ignoring it:

https://github.com/rails/rails/blob/master/activerecord/lib/active_record/migration.rb#L909-L915

Also - according to the docs, :nsec is the default used in the cache_key and I don't see anything related to migrations there.

Though I suppose if you are using rails cache you'll see a different key by changing that option.

(you can see the allowed values with Time::DATE_FORMATS)

The only configuration, that I can see, is allowed to migration names is to use integer vs timestamps: config.active_record.timestamped_migrations

And if you're not working alone, you should also leave that option as is.

Upvotes: 4

Related Questions