Skip to content

Instantly share code, notes, and snippets.

@samnang
Created September 9, 2011 08:42
Show Gist options
  • Select an option

  • Save samnang/1205781 to your computer and use it in GitHub Desktop.

Select an option

Save samnang/1205781 to your computer and use it in GitHub Desktop.
Using view_context
# 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