method
view_context
v3.1.0 -
Show latest stable
-
1 note -
Class: AbstractController::Rendering
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0 (0)
- 3.0.9 (-2)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
view_context()
public
An instance of a view class. The default view class is ActionView::Base
The view class must have the following methods: View.new[lookup_context, assigns, controller]
Create a new ActionView instance for a controller
View#render[options]
Returns String with the rendered template
Override this method in a module to change the default behavior.
Register or
log in
to add new notes.
dennismonsewicz -
January 8, 2013
1 thank
Helper Methods inside of a Controller
When needing to include a helper method inside of a controller, instead of including the ENTIRE helper module, simply use this method like so:
module ApplicationHelper def fancy_helper(str) str.titleize end end class MyController < ApplicationController def index @title = view_context.fancy_helper "dogs are awesome" end end