Skip to content

Instantly share code, notes, and snippets.

View patrickberkeley's full-sized avatar

Patrick Berkeley patrickberkeley

View GitHub Profile
<html>
<head>
<title>test</title>
</head>
<body>
<h1>testing gist</h1>
<script src="http://gist.github.com/3806.js"></script>
</body>
</html>
Inflector.inflections do |inflect|
inflect.plural 'still life'
inflect.singular 'still lives'
end
<select name="product[tag_ids][]">
<option></option>
<%= options_from_collection_for_select(tag.children, "id", "name") %>
</select>
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
@data={:last_order_list_view=>"All", :order_id=>nil, :cart=>#<Cart:0x250c27c @items=[#<OrderLineItem id: nil, item_id: 2, order_id: 0, quantity: 1, unit_price: 95.0, name: "test">], @shipping_cost=0.0, @tax=0.0, @total=0.0>, :user=>1, :return_to=>nil, :product_id=>"2", "flash"=>{}}
# My sample caconfig.cnf file.
#
# Default configuration to use when one is not provided on the command line.
#
[ ca ]
default_ca = local_ca
#
#
# Default location of directories and files needed to generate certificates.
#
Filter chain halted as [#<ActionController::Filters::ClassMethods::SymbolFilter:0x2aaaaec955f8 @filter=:ssl_required>] rendered_or_redirected.
<% if @order_account.cc_type %>
<% @selected = @order_account.cc_type %>
<% end %>
<td><%= select('order_account', 'cc_type', OrderAccount.cc_type, {:selected => @selected}, {:tabindex => "9"}) %>
def run_transaction_paypal_wpp(remote_ip)
ba = self.billing_address
logger.info ("\n\n\n\n Before credit_card:#{self.account.cc_type} \n\n\n\n")
credit_card = ActiveMerchant::Billing::CreditCard.new(
:type => self.account.cc_type.to_s,
:number => self.account.cc_number,
:month => self.account.expiration_month,
:year => self.account.expiration_year,
:first_name => ba.first_name,
:last_name => ba.last_name
Product.find_by_category(category_id, ????, "display_on ASC")