Rendering in Rails is ‘magic’, in that it’s not actually getting run in
the
context of your controller. The renderer takes your controller’s
instance
methods ( @varname ) and makes them available to the template. Any
methods
you try to call will be looked for in the Controller’s Helper module.
Seeing
as you’re using #render in an action, you’re better off calling and
saving
the data before the #render call: