Tag: 动作缓存

一旦启用了动作缓存,format.js就不会操作dom

注意:我在这里提出一个逻辑我在做什么。 我在做什么: 考虑我们列出产品和分页的基本索引操作。 现在使用remote-true选项我启用了基于ajax的分页。 到目前为止,事情完美无缺。 看看示例代码。 产品控制器: 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 } format.js end end Index.html.erb Products // products partial is just basic html rendering $(function(){ $(‘.pagination a’).attr(‘data-remote’, ‘true’) }); index.js.erb的 jQuery(‘#products’).html(” ‘products/products’ ) %>”); […]