What is the difference between Controller and Helper methods?

3

Architectural and Conceptual Doubt:

I have a model Item that has attributes nome_ptbr and nome_en .

I've done the following method:

def display_nome
  nome_ptbr || nome_en
end

Where should I put these methods in controller or helper ? What's the difference between the two?

    
asked by anonymous 13.05.2014 / 16:05

1 answer

4

Helpers are meant to be used by views .

If this method is used only for views, write it in the helper.

If it was meant to be used in the application, do it in the model if you need it on more than one controller, or do it in the controller if it is specific to a controller.

View this SO-en question .

    
13.05.2014 / 18:01