Controller instance variables not visible in helper method called from rjs template

I have the following code in an rjs template that I should like to move to a helper method associated with the controller:

if @read_access.value == "MemberEntityAccessibility"   page.insert_html :bottom, 'read_access_list',                    :partial => 'grantee',                    :collection => @read_grantees   page.show 'set_read_member_entities' end

I created a helper method called display_grantees and placed the above code within it.

I then called the method from within the existing rjs template using page.display_grantees.

I get an error complaining of a nil object for @read_access (ie. nil.value)

If I leave the code in the rjs template, it works fine. That is, I know the instance variables @read_access etc are being initialised correctly.

Thanks.

I have the following code in an rjs template that I should like to move to a helper method associated with the controller:

if @read_access.value == "MemberEntityAccessibility"   page.insert_html :bottom, 'read_access_list',                    :partial => 'grantee',                    :collection => @read_grantees   page.show 'set_read_member_entities' end

I created a helper method called display_grantees and placed the above code within it.

I then called the method from within the existing rjs template using page.display_grantees.

Try calling the helper as

            controller.display_grantees(page)