Permalink
Browse files

Merge pull request #440 from yeban/readme

README: show how to define helper functions in a separate `module`
  • Loading branch information...
2 parents e5d511f + 7abe19c commit 4ff6a8c65f963944272f265bdbdc4ca720a71ae0 @rkh rkh committed Jan 2, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 README.rdoc
View
@@ -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

0 comments on commit 4ff6a8c

Please sign in to comment.