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:
This would try and cache the activerecord::relation object rather the actual query results. You need to force execution of the query, ie
Rails.cache.fetch("@user.postings.includes(:category)") do @user.postings.includes(:category).to_a end
Fred