Controller instance variables not visible in helper method c

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.

[email protected] wrote:

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)

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


We develop, watch us RoR, in numbers too big to ignore.

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