[PATCH] Add support for setting cache_id and convience option :find_by
Reported by Elijah Miller | August 17th, 2007 @ 07:07 PM
Allows cache_fu to use something other than .id for the "id" of a cached model. This is accessible through your own cache_id method or doing "acts_as_cached :id => :user_id". Make sure that the id you're
about to use is unique, and you'll probably want to set the finder to something like :find_by_user_id.
Because you'll almost always want to set these two options together, :find_by => :user_id will automatically turn into :finder => :find_by_user_id, :cache_id => :user_id
Comments and changes to this ticket
-
Chris Wanstrath August 17th, 2007 @ 07:19 PM
- State changed from new to resolved
(from [325]) - Add support for setting cache_id and convience option :find_by [Elijah Miller] [#87 state:resolved]
-
Chris Wanstrath August 17th, 2007 @ 07:19 PM
Awesome, applied.
Just a test/spec note. Instead of:
Story.cache_options.include?(:pengiuns).should.equal true
you can just do
Story.cache_options.should.include :pengiuns
Same with negatives (
should.not.include
).Thanks.
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป