Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

README: show how to define helper functions in a separate `module`

Developers might prefer to define helpers in a separate `module`, particularly
for modular apps, so let's provide an example in the docs.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
  • Loading branch information...
commit 7abe19cc59d3dc6b6be160df5af7585e2c0038fc 1 parent 5eb65ef
@yeban yeban authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 README.rdoc
View
16 README.rdoc
@@ -679,6 +679,22 @@ route handlers and templates:
bar(params[:name])
end
+Helper methods can be separately defined in a module:
+
+ module FooUtils
+ def bar(name)
+ "#{name}bar"
+ end
+ end
+
+ module MooUtils
+ # ...
+ end
+
+ helpers FooUtils, MooUtils
+
+The effect is same as including a module.
+
=== Using Sessions
A session is used to keep state during requests. If activated, you have one
Please sign in to comment.
Something went wrong with that request. Please try again.