n8 / multi_fetch_fragments

Multi-fetch Fragments makes rendering and caching a collection of template partials easier and faster.
http://ninjasandrobots.com/rails-faster-partial-rendering-and-caching
MIT License
539 stars 63 forks source link

wrong number of arguments (1 for 2) #18

Closed zacksiri closed 11 years ago

zacksiri commented 11 years ago

I am getting this error after upgrading to 0.0.14

here is the line in question

<%= render partial: 'activity', collection: @activities, cache: true %>
zacksiri commented 11 years ago

stack trace shows this

  (gem) multi_fetch_fragments-0.0.14/lib/multi_fetch_fragments.rb:29:in `block in render_collection_with_multi_fetch_cache'
  (gem) multi_fetch_fragments-0.0.14/lib/multi_fetch_fragments.rb:24:in `render_collection_with_multi_fetch_cache'
nickurban commented 11 years ago

I'm having the same problem.

n8 commented 11 years ago

What version of Rails are you guys using?

nickurban commented 11 years ago

ruby '2.0.0' gem 'rails', '3.2.13'

zacksiri commented 11 years ago

Yep me too

samratjp commented 11 years ago

Me too - same version of Rails but 1.9.3 ruby. Any updates on this guys?

cpuguy83 commented 11 years ago

I believe this is coming from cache_digests v 0.3.0. The issue is on line 29 of multi_fetch_fragments.rb

key_with_optional_digest = @view.fragment_name_with_digest(key)

@view.fragment_name_with_digest is looking for a second argument (dependencies)

I've tried fooling around with it but ran into other issues.

n8 commented 11 years ago

I think I have this fixed now. To deal with that cache_digests change I now make this gem do this:

key_with_optional_digest = @view.fragment_name_with_digest(key, @view.view_cache_dependencies)
cpuguy83 commented 11 years ago

Now getting an issue in redis-store: undefined method 'match' for #<Array:0x007f8419d2e3e0>

I copied in the cache keys that I was trying to pull for my fragments and directly called Rails.cache.read_mutli *my_keys and it does work... so it looks like we need to splat the key argument now.