action-caching

Rails Action Caching for user specific records

放肆的年华 提交于 2019-12-07 02:13:25
问题 I am a rails newbie trying to implement caching for my app. I installed memcached and configured it in my development.rb as follows: config.action_controller.perform_caching = true config.cache_store = :mem_cache_store I have a controller ProductsController that shows user specific products when they are logged in. class ProductsController < ApplicationController caches_action :index, :layout => false before_filter :require_user def index @user.products end end The route for index action is:

format.js is not manipulating dom once action caching enabled

╄→гoц情女王★ 提交于 2019-12-04 17:56:25
问题 Note: I am presenting a logic here what I am doing. What I am doing: Think about the basic index action where we are listing products and with pagination. Now using remote-true option I have enabled ajax based pagination. So far things works perfectly fine. Take a look on sample code. Products Controller: def index @products = Product.paginate(:order =>"name ASC" ,:page => params[:page], :per_page => 14) respond_to do |format| format.html # index.html.erb format.json { render json: @products