Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

:find_by with cache_fu

#212

The current setup for :find_by ends up causing problems with get_caches. I've specified :find_by => :name in one of classes and was constantly puzzled when get_caches would not find perfectly valid named records.

I eventually tracked it down to fetch_cachable_data(), which loads AR records that miss the cache. It uses the :finder method which gets set to :find_by_name, but then only returns the first named record... Duh! It should be :find_all_by_name.

Changing the assignment in acts_as_cached.rb works like a charm!

  1. convert the find_by shorthand

if find_by = options.delete(:find_by)

options[:finder] = "find_all_by_#{find_by}".to_sym

options[:cache_id] = find_by

end

Reported by Lee Iverson · April 28th, 2008 @ 01:56 PM

State: new
Milestone: none
Assigned to: Chris Wanstrath Chris Wanstrath

Activity

No comments yet.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.