contentful / contentful_rails

A ruby gem to help you quickly integrate Contentful into your Rails site
MIT License
52 stars 35 forks source link

Using caching and the preview API simultaneously is impossible #15

Open ericgross opened 8 years ago

ericgross commented 8 years ago

Due to the following code, it is impossible to test caching while also testing the preview API - would it be possible to separate these concepts so that both could be used at the same time?

      def updated_at_with_caching
        if ContentfulRails.configuration.perform_caching && !ContentfulModel.use_preview_api
          Rails.cache.fetch(self.timestamp_cache_key) do
            updated_at_without_caching
          end
        else
          updated_at_without_caching
        end
      end  
dlitvakb commented 6 years ago

Hey @ericgross,

Sorry I took so long to respond,

I'm currently working on a new release of this gem to match the 1.0.0 release of contentful_model, I'm going to think about this and consider adding it. I'll update you on the decision once I've discussed it with my team.

Cheers