Skip to content

Instantly share code, notes, and snippets.

@george
Created July 6, 2011 16:39
Show Gist options
  • Save george/1067702 to your computer and use it in GitHub Desktop.
Save george/1067702 to your computer and use it in GitHub Desktop.
module ProductsHelper
def print_price(price)
number_to_currency(price)
end
def print_stock(quantity)
if quantity > 0
content_tag :span, "In Stock (#{quantity})", :class => "in_stock"
else
content_tag :span, "Out of Stock", :class => "out_stock"
end
end
def product_image(filename)
image_tag "/images/products/#{filename}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment