Guest User

Untitled

a guest
Jul 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. ##When Price == "$100"
  2.  
  3. ProductsController.cleanup @product.price = 0.0
  4. before_validation :cleanup_function_one
  5. Product.cleanup_function_one price = 0.0
  6. validate :cleanup_function_two
  7. Product.cleanup_function_two price = 0.0
  8.  
  9.  
  10. Processing Admin::ProductsController#update (for 127.0.0.1 at 2009-12-28 00:23:48) [PUT]
  11. Parameters: {"commit"=>"Update Product", "action"=>"update", "_method"=>"put", "authenticity_token"=>"Yv3tPiwH+3P9K8uGS5gQ8QfSYgdPzyPhR5p4rWI+e6A=", "id"=>"21", "product"=>{"image_id"=>"24", "price"=>"$100,000"}, "controller"=>"admin/products"}
  12.  
  13. ##When Price == "100"
  14.  
  15. ProductsController.cleanup @product.price = 100.0
  16. before_validation :cleanup_function_one
  17. Product.cleanup_function_one price = 100.0
  18. validate :cleanup_function_two
  19. Product.cleanup_function_two price = 100.0
  20.  
  21.  
  22. Processing Admin:: ProductsController#update (for 127.0.0.1 at 2009-12-28 00:26:57) [PUT]
  23. Parameters: {"commit"=>"Update Product", "action"=>"update", "_method"=>"put", "authenticity_token"=>"Yv3tPiwH+3P9K8uGS5gQ8QfSYgdPzyPhR5p4rWI+e6A=", "id"=>"21", "product"=>{"image_id"=>"24", "price"=>"100"}, "controller"=>"admin/products"}
  24.  
  25. ## class Product < ActiveRecord::Base
  26. class Product < ActiveRecord::Base
  27.  
  28. before_validation :cleanup_function_one
  29. validate :cleanup_function_two
  30.  
  31. private
  32.  
  33. def cleanup_function_one
  34. puts "Product.cleanup_function_one price = #{price}"
  35. end
  36.  
  37. def cleanup_function_two
  38. puts "Product.cleanup_function_two price = #{price}"
  39. end
  40.  
  41. end
  42.  
  43. ## ActiveRecord::Schema.define(:version => 20091226104743) do
  44.  
  45. create_table "products", :force => true do |t|
  46. t.integer "image_id"
  47. t.decimal "price"
  48. t.datetime "created_at"
  49. t.datetime "updated_at"
  50. end
Add Comment
Please, Sign In to add comment