22. smartbomb
bmobtrams
semantic helpers
as objects
23. a cart stencil smartbomb
bmobtrams
class CartStencil < Stencil
...
def to_s
render(:partial => 'shared/cart', :object => @cart)
end
def summary
if @cart.blank?
quot;Your cart is empty. Buy stuff!quot;
else
quot;You have #{@cart.size} items in your cart.quot;
end
end
end
25. more than a stencil smartbomb
bmobtrams
module CartControllerHelper
...
end
class UserController
include CartControllerHelper
load_cart :only => [:show]
end
26. smartbomb
bmobtrams
C V
cart cart
(mixin) (stencil)