Ruby on Rails
UnderstandingHelpers

Introduction

Helpers (“view helpers”) are modules that provide methods which are automatically usable in your view. They provide shortcuts to commonly used display code and a way for you to keep the programming out of your views. The purpose of a helper is to simplify the view. It’s best if the view file (RHTML/RXML) is short and sweet, so you can see the structure of the output. Nitty-gritty details are best left to helper methods and partials, where they can be parametrized and used repeatedly.

Write your own

Rails comes packed with many helpers, but you can also write your own. See HowtoWorkWithHelpers for a walkthrough of writing your own helper method.

Use a contributed helper

See 3rdPartyHelpers for a list of helpers others have written.

Howtos relating to specific helpers

API Reference Documentation

category: Understanding