一、问题
module Spree
class Order < Spree::Base
PAYMENT_STATES = %w(balance_due checkout completed credit_owed failed paid pending processing void).freeze
SHIPMENT_STATES = %w(backorder canceled partial pending ready shipped).freeze
extend FriendlyId
friendly_id :number, slug_column: :number, use: :slugged
中 slug_column 后面的冒号什么意思?是 hash key 吗? :key => value == key: value 这一行整体怎么解释?
已经求助亚飞,理解了 friendly_id( :number, {slug_column: :number, use: :slugged})
二、理解 symbol "some_string".object_id == "some_string".object_id #=> false :some_string.object_id == :some_string.object_id #=> true
这些冒号让我很困惑 https://ruby-china.org/topics/15540
三、跟在后面的冒号 跟在后面的冒号表示什么意思?比如 routes.rb 里的"to:"里的冒号 https://ruby-china.org/topics/17907 还有 migration 里的”index:“等等, 在前面是 symbol,但跟在后面是什么意思?
答案::key => value == key: value 只是语法糖而已
四、where to use colon (:) and where to not use it? https://www.ruby-forum.com/topic/2551601 https://ruby-china.org/topics/25706
五、ruby 中冒号还有哪些用法?