Pārlūkot izejas kodu

测试 before 事件

abiao 5 gadi atpakaļ
vecāks
revīzija
1e31a23565
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. 2 1
      app/models/product.rb

+ 2 - 1
app/models/product.rb

@@ -10,12 +10,13 @@ class Product < ActiveRecord::Base
     #after_update :after_update
     before_save :before_save
     after_destroy :del_picture
+    before_validation :do_something
 
     def do_something
         puts params
     end
 
-    do_something
+
 
     def after_create
         #主商品默认关联商品