dewski/json_builder

cache issue

jackbit opened this issue · 4 comments

How to implement cache fragment and action here? it seems the chache_action doesnt work for json_builder

here's my script in controller:

caches_action :index, 
                        :cache_path => Proc.new { |c| "#{c.params[:category].to_s.gsub(/\W/,'_')}_#{c.params[:per_page]}_#{c.params[:page]}" }, 
                        :gzip => :best_speed, 
                        :if => Proc.new { |c| c.params[:category].to_s =~ /all/i }
The output .json seems work
Read fragment views/all_podcast_50_1.json (80.0ms)
Read fragment views/all_twitter_50_1.json (200.8ms)
But .json_builder doesnt work
  Rendered forecasts/index.json.json_builder (25813.2ms)
Completed 200 OK in 36093ms (Views: 25959.5ms)
  Rendered forecasts/index.json.json_builder (10930.8ms)
Completed 200 OK in 46551ms (Views: 11033.0ms)

Could you paste what the contents of forecasts/index.json.json_builder is?

Is there a wiki on how to implement fragment cache with json_builder

I'm wondering about this as well. I guess one of us will have to dig into the source and figure out how to best implement this, but some clues will be very much appreciated.