Instance valiable was lost in render_component_as_string()


I tried to an action via render_component_as_string().
And wanted to suppress layout in this action.

I checked and noticed that “render_component_as_string()” doesn’t accept
“layout” like “render()”.
Then called “render()” in that action like below.

render :layout=>false

Therefore layouts wasn’t used in this action. this behavior is just
But this time Instance valiable that I set in action will lost in


In action —
@foo = “abc”

In view -----
<%= @foo %>
-> “”
<%= @foo.nil? %>
-> true

I think “abc” should be shown here right?

Someone has any idea?

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