I run the grep method to filter by pattern. This is sample code.
companies.grep /city/
However, ruby ββdoes not allow me to enter area_code with a block inside the rails view. Instead, I have to hardcode it like this:
companies.grep /miami/
Keep in mind that a city is a variable. For instance,
city = miami
However, it is being updated. Do you know with whom I can pass a variable before the grep method?
Also, I tried the company .grep / # {city} /, but it didnβt work
source share