Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ViewContext
- def initialize(*args)
- @_content_for = Hash.new
- end
- def content_for(name, content, &block)
- content = capture(&block) if block_given?
- @_content_for[name] = content
- end
- end
- class ActionController::Base
- def view_context
- ViewContext.new
- end
- end
- #####
- @controller = ActionController::Base.new
- @controller.view_context.content_for :foo, :bar
- @controller.view_context.instance_variable_get "@_content_for" # => {}
Add Comment
Please, Sign In to add comment