Topic: Components vs. partials..
I have an older rails app that uses render_component in a few places to render navigation divs. I understand why components are (very) slow compared to for example a partial now and I want to remove them but I'm not sure how to go about it efficiently.
The way it works now is render_component calls an action in my controller which does a .find :all on my Category model and lists them in the relevant (partial) view inside the application layout.
Since render :partial doesn't run any code I have to move the .find into the actual action being shown or the application controller. But the navigation box isn't shown on every single page (just the pages that show the default application layout.)
So either I move the .find into the application controller and have it send a query to the database which sometimes isn't necessary or I move the .find into the relevant actions, possibly having to duplicate it here and there.
I hope that wasn't too confusing Any thoughts would be much appreciated!
* Multiple child models in a dynamic form