Richard Richard - 1 month ago 5x
Ruby Question

Why do you use %w[] in rails?

Why would you ever use %w[] considering arrays in Rails are type-agnostic?


This is the most efficient way to define array of strings, because you don't have to use quotes and commas.

%w(abc def xyz)

Instead of

['abc', 'def', 'xyz']