I have this in a view:
This in new.html.erb
<%= link_to_remote “hit”, :url => { :action => “add_hit”, :id =>
action.id, :player => @game.players[count] }, :update =>
"action#{action.id}" %> <%= link_to_remote “skip”, :url => { :action
=> “add_skip”, :id => action.id, :player =>
@game.players[count] }, :update => “action_#{action.id}” %>
This in partial hit.html.erb
<%= link_to_remote “(hit)”, :url => { :action => “remove_hit”, :id =>
action.id, :game => @game, :count => count, :player =>
@game.players[count] }, :update => "action#{action.id}" %>
This in skip.html.erb
<%= link_to_remote “(skip)”, :url => { :action => “remove_skip”, :id
=> action.id, :game => @game, :count => count, :player =>
@game.players[count] }, :update => "action#{action.id}" %>
This in my controller
def add_hit
@action = Action.find(params[:id])
Player.find(params[:player]).actions << @action
@action.add_hit
render :partial => “hit”, :locals => { :game =>
Game.find(params[:game].id), :action => @action, :count =>
params[:count] }
end
def remove_hit
@action = Action.find(params[:id])
@action.remove_hit
render :partial => “new”, :locals => { :game =>
Game.find(params[:game].id), :action => @action, :count =>
params[:count] }
end
and ditto for skips
Yet I’m still getting nil errors all over the place. Have I not passed
the locals correctly? What am I doing wrong?