spec/models/post.rb in simple_cacheable-1.3.2 vs spec/models/post.rb in simple_cacheable-1.3.3

- old
+ new

@@ -10,12 +10,21 @@ model_cache do with_key with_attribute :user_id with_association :user, :comments, :images, :tags - with_class_method :default_post + with_class_method :default_post, :retrieve_with_user_id, :retrieve_with_both end def self.default_post Post.first end + + def self.retrieve_with_user_id(user_id) + Post.find_by_user_id(user_id) + end + + def self.retrieve_with_both(user_id, post_id) + Post.find(post_id) == Post.find_by_user_id(user_id) + end + end