2
檢查下面的註釋。爲什麼在我做p variant_attributes
之前,blank?
方法返回錯誤,而在它之後,它工作正常嗎?未定義方法'零'... ActiveSupport :: OrderedHash
Ruby on Rails的1.9.2-P0 3.0.3
p variant_attributes.blank?
# => NoMethodError Exception: undefined method `zero?' for {"Brocade w/ Grande Stripe backing"=>3}:ActiveSupport::OrderedHash
p variant_attributes
# => [#<VariantAttribute id: 1251, variant_id: 561, product_option_id: 838, value: "Brocade w/ Grande Stripe backing">]
p variant_attributes.blank?
# => false