sample code:
class AuctionController < ApplicationController
def index
@game_type = 1
end
def start_game
render :update do |page|
page.replace :start_button, :partial => "start_button"
end
end
end
_start_button.html.erb:
<% if @game_type == 1 %>
<%= button_to_function "start", remote_function(function1) %>
<% else %>
<%= button_to_function "start", remote_function(function2) %>
<% end %>
So i am assigning a value of 1 to the variable game_type once the index method is called. then once the auctioneer implements the start_game method it should render the start_button with a function depending on teh @game_type variable. For some reason once start_game is called the @game_type variable is nil again, after it had been assigned a number.
This post has been edited by german129: 20 December 2010 - 04:28 PM

New Topic/Question
Reply




MultiQuote





|