I have this in a view: <td id="action_<%= action.id %>"> <%= render :partial => "new", :locals => { :game => @game, :action => action, :count => count } %> </td> <% elsif action.hit %> <td id="action_<%= action.id %>"> <%= render :partial => "hit", :locals => { :game => @game, :action => action, :count => count } %> </td>
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?