Class: EricWeixin::Xiaodian::SkuName
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- EricWeixin::Xiaodian::SkuName
- Defined in:
- app/models/eric_weixin/xiaodian/sku_name.rb
Class Method Summary collapse
-
.create_skuname(options) ⇒ Object
创建sku name 接收参数: name weixin_name_id 类别id.
Class Method Details
.create_skuname(options) ⇒ Object
创建sku name 接收参数: name weixin_name_id 类别id
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/models/eric_weixin/xiaodian/sku_name.rb', line 7 def self.create_skuname name = EricWeixin::Xiaodian::SkuName.where(wx_name_id: [:wx_name_id], weixin_xiaodian_category_id: [:weixin_xiaodian_category_id]).first name = if name.blank? name = EricWeixin::Xiaodian::SkuName.new name: [:name], weixin_xiaodian_category_id: [:weixin_xiaodian_category_id], wx_name_id: [:wx_name_id] else name.name = [:name] name end name.save! name end |