dimanche 28 juin 2015

What's the correct way to reference a helper in a rails controller?

Sometimes I need to use helper methods in controllers (sanitization methods, rendering text back to the view, various other applications). What's the right way? I've got:

  • self.class.helpers.myhelper
  • view_context.myhelper
  • include MyHelper; myhelper
  • helper MyHelper; myhelper

Aucun commentaire:

Enregistrer un commentaire