Skip to content

Instantly share code, notes, and snippets.

View patrickberkeley's full-sized avatar

Patrick Berkeley patrickberkeley

View GitHub Profile
def add_to_cart
@cart = find_cart
product = Product.find(params[:id])
quantity = params[:quantity]
quantity ||= 1
if quantity.to_i > product.quantity.to_i
logger.info "This product only has #{product.quantity.to_i} remaining."
render :nothing => true, :status => 400 and return
else
<select name="product[tag_ids][]">
<option></option>
<%= options_from_collection_for_select(tag.children, "id", "name") %>
</select>
Inflector.inflections do |inflect|
inflect.plural 'still life'
inflect.singular 'still lives'
end
<html>
<head>
<title>test</title>
</head>
<body>
<h1>testing gist</h1>
<script src="http://gist.github.com/3806.js"></script>
</body>
</html>