Reputation: 267
I rendering a view partial like this.
<%= render :partial => 'resources/positions', :controller => 'resources',
:action => 'this_is_a_test',
:locals => {:id_resource => 42} %>
resources_controller.rb
def this_is_a_test
@test1 = "batman"
render :partial => 'positions'
end
_positions.html.erb
<%= @test1 %>
but the variable @test1 is empty. Do you have any idea ?
Upvotes: 0
Views: 58
Reputation: 5060
def this_is_a_test
render :partial => 'positions', :locals => { :test1 => "batman" }
end
and change _position.html.erb
to
<%= test1 %>
Upvotes: 1