Call methods within a given block

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:

@filter = filter
render(:update) { |page|
page.replace_html ‘filterkriterien’, :partial => ‘partials/filter’,
:locals => { :filter => @filter }


You can designate controller methods be available to the views by using
'helper_method' in the controller. Like so:

def whatever_controller_method
  # whatever
helper_method :whatever_controller_method