Rails - Using %W

后端 未结 4 781
借酒劲吻你
借酒劲吻你 2021-02-06 21:43

I have the following which works well:

def steps
    %w[hello billing confirmation]
end

steps.first

But I want to do this:

  d         


        
4条回答
  •  孤独总比滥情好
    2021-02-06 22:09

    %w creates an "array of words," and uses whitespace to separate each value. Since you want to separate on another value (in this case, whitespace outside sets of quotation marks), just use a standard array:

    ['Upload a photo', 'Billing Info', 'Confirmation Screen']
    

提交回复
热议问题