Created
September 9, 2011 08:42
-
-
Save samnang/1205781 to your computer and use it in GitHub Desktop.
Using view_context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # app/controllers/posts_controller.rb | |
| class PostsController < ActionController::Base | |
| def show | |
| # ... | |
| tags = view_context.generate_tags(@post) | |
| email_link = view_context.mail_to(@user.email) | |
| # ... | |
| end | |
| end | |
| # app/helpers/posts_helper.rb | |
| module PostsHelper | |
| def generate_tags(post) | |
| "Generate Tags" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment