Ruby on Rails Tuesday, December 25, 2012

I have such action in my controller:

def my

      @user = Ads::User.find current_user.id

      @postings = Rails.cache.fetch("@user.postings.includes(:category)") do

        @postings = @user.postings.includes(:category)

      end

end

I'm trying to cache @postings and get such error:

Marshalling error for key '@user.postings.includes(:category)': can't dump anonymous class #<Module:0x000000048f9040>

You are trying to cache a Ruby object which cannot be serialized to memcached.


If I try to cache @postings without includes there are no errors. Can't figure out what is the problem


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/2lARlH6VlEkJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment