-
Scout Monitoring
Rennaisance engineers rejoice! 1 gem 5 min to app monitoring. 5-minute onboarding. No sales team. Devs in the support channels. No DevOps team required. Get the free app insights every engineer deserves with Scout Monitoring.
That’s it! There’s obviously things that could be improved here (e.g., create a parent controller for inbound/outbound controllers to inherit from, DRY up the _stations.html.erb partial, etc.), but I never claimed this was a perfect example. If you want to look at the code more closely, please reference the GitHub repository. And if you want to go even further beyond, stay tuned for the next installment of our Metaprogramming in Ruby series!
We can then add the data into our view using a partial that I’ll call _stations.html.erb. I’m using tailwindcss here, but the styling is immaterial for this example.
It is very seldom the case that metaprogramming is the only answer to a given problem. The notable exception to this would be if you wanted to write a domain-specific language (DSL) or framework, such as Rails. In that case, yes, you’ll probably be living and breathing metaprogramming.