{ controller: 'cart', action: 'add_to_cart' }%> erb view class CartController < ActionController::Base def add_to_cart @item = CartItem.new @cart.items << @item end end controller page.insert_html :bottom, :items, partial: 'item', object: @item page.replace_html :items_count, I18n.t(:item, count: @cart.items.count) rjs view