Created
June 17, 2010 19:06
-
-
Save littlefyr/442593 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rake routes | |
--- a bunch of routes --- | |
new_order_checkout GET /orders/:order_id/checkout/new(.:format) {:controller=>"checkouts", :action=>"new"} | |
paypal_checkout_order_checkout /orders/:order_id/checkout/paypal_checkout(.:format) {:controller=>"checkouts", :action=>"paypal_checkout"} | |
paypal_confirm_order_checkout /orders/:order_id/checkout/paypal_confirm(.:format) {:controller=>"checkouts", :action=>"paypal_confirm"} | |
paypal_payment_order_checkout /orders/:order_id/checkout/paypal_payment(.:format) {:controller=>"checkouts", :action=>"paypal_payment"} | |
paypal_finish_order_checkout /orders/:order_id/checkout/paypal_finish(.:format) {:controller=>"checkouts", :action=>"paypal_finish"} | |
edit_order_checkout GET /orders/:order_id/checkout/edit(.:format) {:controller=>"checkouts", :action=>"edit"} | |
order_checkout GET /orders/:order_id/checkout(.:format) {:controller=>"checkouts", :action=>"show"} | |
PUT /orders/:order_id/checkout(.:format) {:controller=>"checkouts", :action=>"update"} | |
DELETE /orders/:order_id/checkout(.:format) {:controller=>"checkouts", :action=>"destroy"} | |
POST /orders/:order_id/checkout(.:format) {:controller=>"checkouts", :action=>"create"} | |
orders GET /orders(.:format) {:controller=>"orders", :action=>"index"} | |
POST /orders(.:format) {:controller=>"orders", :action=>"create"} | |
new_order GET /orders/new(.:format) {:controller=>"orders", :action=>"new"} | |
edit_order GET /orders/:id/edit(.:format) {:controller=>"orders", :action=>"edit"} | |
order GET /orders/:id(.:format) {:controller=>"orders", :action=>"show"} | |
PUT /orders/:id(.:format) {:controller=>"orders", :action=>"update"} | |
DELETE /orders/:id(.:format) {:controller=>"orders", :action=>"destroy"} | |
--- a bunch of routes --- | |
GET /orders/:order_id/checkout/new(.:format) {:controller=>"checkouts", :action=>"new"} | |
set_shipping_method_order_checkout /orders/:order_id/checkout/set_shipping_method(.:format) {:controller=>"checkouts", :action=>"set_shipping_method"} | |
GET /orders/:order_id/checkout/edit(.:format) {:controller=>"checkouts", :action=>"edit"} | |
GET /orders/:order_id/checkout(.:format) {:controller=>"checkouts", :action=>"show"} | |
PUT /orders/:order_id/checkout(.:format) {:controller=>"checkouts", :action=>"update"} | |
DELETE /orders/:order_id/checkout(.:format) {:controller=>"checkouts", :action=>"destroy"} | |
POST /orders/:order_id/checkout(.:format) {:controller=>"checkouts", :action=>"create"} | |
add_variant_only_orders POST /orders/add_variant_only(.:format) {:controller=>"orders", :action=>"add_variant_only"} | |
GET /orders/add_variant_only(.:format) {:controller=>"orders", :action=>"add_variant_only"} | |
GET /orders(.:format) {:controller=>"orders", :action=>"index"} | |
POST /orders(.:format) {:controller=>"orders", :action=>"create"} | |
GET /orders/new(.:format) {:controller=>"orders", :action=>"new"} | |
GET /orders/:id/edit(.:format) {:controller=>"orders", :action=>"edit"} | |
calculate_shipping_order GET /orders/:id/calculate_shipping(.:format) {:controller=>"orders", :action=>"calculate_shipping"} | |
GET /orders/:id(.:format) {:controller=>"orders", :action=>"show"} | |
PUT /orders/:id(.:format) {:controller=>"orders", :action=>"update"} | |
DELETE /orders/:id(.:format) {:controller=>"orders", :action=>"destroy"} | |
POST /orders/add_variant_only(.:format) {:controller=>"orders", :action=>"add_variant_only"} | |
GET /orders/add_variant_only(.:format) {:controller=>"orders", :action=>"add_variant_only"} | |
GET /orders(.:format) {:controller=>"orders", :action=>"index"} | |
POST /orders(.:format) {:controller=>"orders", :action=>"create"} | |
GET /orders/new(.:format) {:controller=>"orders", :action=>"new"} | |
GET /orders/:id/edit(.:format) {:controller=>"orders", :action=>"edit"} | |
GET /orders/:id(.:format) {:controller=>"orders", :action=>"show"} | |
PUT /orders/:id(.:format) {:controller=>"orders", :action=>"update"} | |
DELETE /orders/:id(.:format) {:controller=>"orders", :action=>"destroy"} | |
--- a bunch of routes --- | |
order_line_items GET /orders/:order_id/line_items(.:format) {:controller=>"line_items", :action=>"index"} | |
POST /orders/:order_id/line_items(.:format) {:controller=>"line_items", :action=>"create"} | |
new_order_line_item GET /orders/:order_id/line_items/new(.:format) {:controller=>"line_items", :action=>"new"} | |
edit_order_line_item GET /orders/:order_id/line_items/:id/edit(.:format) {:controller=>"line_items", :action=>"edit"} | |
order_line_item GET /orders/:order_id/line_items/:id(.:format) {:controller=>"line_items", :action=>"show"} | |
PUT /orders/:order_id/line_items/:id(.:format) {:controller=>"line_items", :action=>"update"} | |
DELETE /orders/:order_id/line_items/:id(.:format) {:controller=>"line_items", :action=>"destroy"} | |
order_creditcards GET /orders/:order_id/creditcards(.:format) {:controller=>"creditcards", :action=>"index"} | |
POST /orders/:order_id/creditcards(.:format) {:controller=>"creditcards", :action=>"create"} | |
new_order_creditcard GET /orders/:order_id/creditcards/new(.:format) {:controller=>"creditcards", :action=>"new"} | |
edit_order_creditcard GET /orders/:order_id/creditcards/:id/edit(.:format) {:controller=>"creditcards", :action=>"edit"} | |
order_creditcard GET /orders/:order_id/creditcards/:id(.:format) {:controller=>"creditcards", :action=>"show"} | |
PUT /orders/:order_id/creditcards/:id(.:format) {:controller=>"creditcards", :action=>"update"} | |
DELETE /orders/:order_id/creditcards/:id(.:format) {:controller=>"creditcards", :action=>"destroy"} | |
order_creditcard_payments GET /orders/:order_id/creditcard_payments(.:format) {:controller=>"creditcard_payments", :action=>"index"} | |
POST /orders/:order_id/creditcard_payments(.:format) {:controller=>"creditcard_payments", :action=>"create"} | |
new_order_creditcard_payment GET /orders/:order_id/creditcard_payments/new(.:format) {:controller=>"creditcard_payments", :action=>"new"} | |
edit_order_creditcard_payment GET /orders/:order_id/creditcard_payments/:id/edit(.:format) {:controller=>"creditcard_payments", :action=>"edit"} | |
order_creditcard_payment GET /orders/:order_id/creditcard_payments/:id(.:format) {:controller=>"creditcard_payments", :action=>"show"} | |
PUT /orders/:order_id/creditcard_payments/:id(.:format) {:controller=>"creditcard_payments", :action=>"update"} | |
DELETE /orders/:order_id/creditcard_payments/:id(.:format) {:controller=>"creditcard_payments", :action=>"destroy"} | |
GET /orders(.:format) {:controller=>"orders", :action=>"index"} | |
POST /orders(.:format) {:controller=>"orders", :action=>"create"} | |
GET /orders/new(.:format) {:controller=>"orders", :action=>"new"} | |
GET /orders/:id/edit(.:format) {:controller=>"orders", :action=>"edit"} | |
address_info_order GET /orders/:id/address_info(.:format) {:controller=>"orders", :action=>"address_info"} | |
GET /orders/:id(.:format) {:controller=>"orders", :action=>"show"} | |
PUT /orders/:id(.:format) {:controller=>"orders", :action=>"update"} | |
DELETE /orders/:id(.:format) {:controller=>"orders", :action=>"destroy"} | |
order_shipments GET /orders/:order_id/shipments(.:format) {:controller=>"shipments", :action=>"index"} | |
POST /orders/:order_id/shipments(.:format) {:controller=>"shipments", :action=>"create"} | |
new_order_shipment GET /orders/:order_id/shipments/new(.:format) {:controller=>"shipments", :action=>"new"} | |
edit_order_shipment GET /orders/:order_id/shipments/:id/edit(.:format) {:controller=>"shipments", :action=>"edit"} | |
shipping_method_order_shipment GET /orders/:order_id/shipments/:id/shipping_method(.:format) {:controller=>"shipments", :action=>"shipping_method"} | |
order_shipment GET /orders/:order_id/shipments/:id(.:format) {:controller=>"shipments", :action=>"show"} | |
PUT /orders/:order_id/shipments/:id(.:format) {:controller=>"shipments", :action=>"update"} | |
DELETE /orders/:order_id/shipments/:id(.:format) {:controller=>"shipments", :action=>"destroy"} | |
GET /orders/:order_id/checkout/new(.:format) {:controller=>"checkouts", :action=>"new"} | |
register_order_checkout /orders/:order_id/checkout/register(.:format) {:controller=>"checkouts", :action=>"register"} | |
GET /orders/:order_id/checkout/edit(.:format) {:controller=>"checkouts", :action=>"edit"} | |
GET /orders/:order_id/checkout(.:format) {:controller=>"checkouts", :action=>"show"} | |
PUT /orders/:order_id/checkout(.:format) {:controller=>"checkouts", :action=>"update"} | |
DELETE /orders/:order_id/checkout(.:format) {:controller=>"checkouts", :action=>"destroy"} | |
POST /orders/:order_id/checkout(.:format) {:controller=>"checkouts", :action=>"create"} | |
GET /orders(.:format) {:controller=>"orders", :action=>"index"} | |
POST /orders(.:format) {:controller=>"orders", :action=>"create"} | |
GET /orders/new(.:format) {:controller=>"orders", :action=>"new"} | |
GET /orders/:id/edit(.:format) {:controller=>"orders", :action=>"edit"} | |
fatal_shipping_order GET /orders/:id/fatal_shipping(.:format) {:controller=>"orders", :action=>"fatal_shipping"} | |
GET /orders/:id(.:format) {:controller=>"orders", :action=>"show"} | |
PUT /orders/:id(.:format) {:controller=>"orders", :action=>"update"} | |
DELETE /orders/:id(.:format) {:controller=>"orders", :action=>"destroy"} | |
--- a bunch of routes --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_variant_only_orders POST /orders/add_variant_only(.:format) {:controller=>"orders", :action=>"add_variant_only"} | |
GET /orders/add_variant_only(.:format) {:controller=>"orders", :action=>"add_variant_only"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OrdersController.class_eval do | |
skip_before_filter :verify_authenticity_token, :only => [:add_variant_only] | |
def add_variant_only | |
begin | |
order = find_order | |
variants = param[:variants].map{|variant_id, quant|[Variant.find(key), quant]}.each do |item| | |
order.add_variant item[0], item[1] | |
end | |
rescue ActiveRecord::RecordNotFound => rnf | |
flash[:error] = "Product does not exist" | |
render :template => "orders/edit" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment