This Gist compares two different patterns to writing your controllers. My personal preference is orders_first_controller.rb
, please feel free to comment with pros and cons of both patterns.
For this example we are using locals in both examples since instance variables encourage a leaky controller and views.
Machine comparisons were performed with flog and flay
Both scored a 0 on flay.
Props to @frank-west-iii for breaking out
def order
(with some unnecessary branching) intodef new_order
anddef order
.👍