Richard Richard - 6 months ago 18
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']