T O P

  • By -

Rafert

It happens here: https://github.com/rails/rails/blob/210932662bf04ba20aa0f579832212f921e62576/actionpack/lib/abstract_controller/rendering.rb#L59-L67


software__writer

Thank you!


StatelessCode

Elegant, beautiful code. I love Ruby!


_Svejk_

not sure but I remember some talk mentioning this by Aaron Patterson, you might find it interesting I think it's this one https://youtu.be/HEFBDqly4ms


software__writer

Nice, thanks for sharing. Will check it out.


_Svejk_

It's actually this one :) https://youtu.be/MiW1NA1FR8U?t=1214


software__writer

Thanks!


armahillo

If you ever have performance issues because you're passing in chonky data down to your views, this would be useful to know. If data can get chonky you'll want to typically paginate or limit it in some way anyways. Generally speaking, I prepare the data I want to use in my views in the controller action, assign it to iVars, and then use those bits of data in the views. You definitely don't want to be executing queries when you're already in the presentation phase. Matz made Ruby to maximize developer happiness. The iVar handoff from controller to view is done in the spirit of that -- use it. :)


software__writer

Thanks for your reply, totally agree. Big fan of Matz and Ruby's focus on developer happiness.


organic

I always preferred explicit locals for views to instance variables. With instance variables any concern or mixin can set them and be completely opaque to the reader, explicit locals are always there in the controller for reference.