[Rails] form_helpers ?

Stephen Bartholomew
Sun, 16 Jul 2006 17:19:47 -0000

> :), so form_helpers are part of the code that goes into the app\helpers
> files ?
I''m not sure what you mean by form_helpers - are you talking about the
rails form helpers like ''text_field'' or
''submit_tag''?

View helpers are defined in app/helpers.  So you can write methods that
will be accessible in your views:

-- app/helpers/pages_helper.rb
module PagesHelper
   def say(message)
     message
   end
end

-- app/views/pages/index.rhtml
<%= say ''Hello!'' %>

This would display:

Hello!

Hope that helps,

Steve