Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##When Price == "$100"
- ProductsController.cleanup @product.price = 0.0
- before_validation :cleanup_function_one
- Product.cleanup_function_one price = 0.0
- validate :cleanup_function_two
- Product.cleanup_function_two price = 0.0
- Processing Admin::ProductsController#update (for 127.0.0.1 at 2009-12-28 00:23:48) [PUT]
- 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"}
- ##When Price == "100"
- ProductsController.cleanup @product.price = 100.0
- before_validation :cleanup_function_one
- Product.cleanup_function_one price = 100.0
- validate :cleanup_function_two
- Product.cleanup_function_two price = 100.0
- Processing Admin:: ProductsController#update (for 127.0.0.1 at 2009-12-28 00:26:57) [PUT]
- Parameters: {"commit"=>"Update Product", "action"=>"update", "_method"=>"put", "authenticity_token"=>"Yv3tPiwH+3P9K8uGS5gQ8QfSYgdPzyPhR5p4rWI+e6A=", "id"=>"21", "product"=>{"image_id"=>"24", "price"=>"100"}, "controller"=>"admin/products"}
- ## class Product < ActiveRecord::Base
- class Product < ActiveRecord::Base
- before_validation :cleanup_function_one
- validate :cleanup_function_two
- private
- def cleanup_function_one
- puts "Product.cleanup_function_one price = #{price}"
- end
- def cleanup_function_two
- puts "Product.cleanup_function_two price = #{price}"
- end
- end
- ## ActiveRecord::Schema.define(:version => 20091226104743) do
- create_table "products", :force => true do |t|
- t.integer "image_id"
- t.decimal "price"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
Add Comment
Please, Sign In to add comment