Render :update and local variables

Probably asked and answered, but…

Why are controller instance variables visible in the block passed to
render :update, but controller private methods are not?

This does not work:

class MyController < ApplicationController
def some_action
render :update do |page|
page.replace_html ‘element’, some_data # some_data is not
defined
end
end

private
def some_data

end
end

On Dec 5, 8:08 pm, kevin cline [email protected] wrote:

Probably asked and answered, but…

Why are controller instance variables visible in the block passed to
render :update, but controller private methods are not?

Because at the end of the day it’s the same as rendering any old
template: instances variables are copied across into a magic object,
which is not the controller (and so controller private methods are not
available)

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs