Sfoglia il codice sorgente

测试 before 事件

abiao 5 anni fa
parent
commit
e7a96b7aa2
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  1. 4 2
      app/models/product.rb

+ 4 - 2
app/models/product.rb

@@ -4,7 +4,7 @@ class Product < ActiveRecord::Base
     belongs_to :product_cat, :foreign_key => :category_id
     belongs_to :merchant, :foreign_key => :merchant_id
     validates :name,:buy_price,:price,:category_id,:count,:robo_balance_price, presence: true
-    attr_accessor :v_share_img,:get_size_enum,:gross_interest_rate
+    attr_accessor :v_share_img,:get_size_enum,:gross_interest_rate,:do_something
     after_find :get_size_enum
     after_create :after_create
     #after_update :after_update
@@ -15,6 +15,8 @@ class Product < ActiveRecord::Base
         puts params
     end
 
+    do_something
+
     def after_create
         #主商品默认关联商品
         if self.show_flag
@@ -133,7 +135,7 @@ class Product < ActiveRecord::Base
 
         list do
             filters [:id,:detail,:status,:name]
-            do_something
+
             field :id
             field :merchant_id
             field :merchant