David R
David R

Reputation: 328

When to use a custom view helper class in Rails

I tend to do a lot with partials. They almost feel like small helper classes that take some parameters and spit out view snippets.

My question is, when is it appropriate to make a separate class for a view? Would this be appropriate for something with some additional logic like a menu system that needs to be available for testing?

I have a feeling I may be overusing partials.

Upvotes: 2

Views: 1366

Answers (1)

shweta
shweta

Reputation: 8169

you can use a helper to build a single unit of display. and you can use partial to build complex unit of display.

see Helpers vs. Partials and What belongs in a helper method?

Upvotes: 2

Related Questions