Guest User

Untitled

a guest
May 26th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. ################customer_controller.rb
  2.  
  3. def create
  4. @customer = Customer.new(params[:customer])
  5.  
  6. respond_to do |format|
  7. if @customer.save
  8.  
  9. #flash[:notice] = 'Customer was successfully created.'
  10. #format.html { redirect_to(@customer, :action => 'new') }
  11. format.html {redirect_to(:add_to_cart)}
  12.  
  13. # format.xml { render :xml => @customer, :status => :created, :location => @customer }
  14.  
  15. else
  16. format.html { render :action => "new" }
  17. format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }
  18. end
  19.  
  20. end
  21. end
  22.  
  23. def add_to_cart
  24.  
  25. productdisplay = Product.find(params[:id])
  26.  
  27. @productdisplay = Product.find(:first, :conditions => ['id > ? AND product_active = ?', params[:id], "yes"])
  28.  
  29. end
  30.  
  31.  
  32. ##########add_to_cart.html.erb
  33. <%= link_to "next", add_to_cart_url %>
  34.  
  35.  
  36.  
  37. #########routes.rb
  38. map.add_to_cart 'add_to_cart', :controller => 'customers', :action => 'add_to_cart'
Add Comment
Please, Sign In to add comment