Sharagoz -- wrote:
> You can store it in a session variable to keep track across requests
> session[:hole_number] = hole_number

For the future reference of noobs like myself, this is how I did it. 
(For Agile Web Development with Rails readers, it's much easier than 
their Cart session would have you believe.)

def start #start the round
  session[:hole_number] = 0
  redirect_to(new)
end

def new #modified scaffold
  @hole = Hole.new
  session[:hole_number] += 1
  ...
end

def create @modified scaffold
  @hole = Hole.new(params[:hole])
  @hole.hole_number = session[:hole_number]
  ....other stuff...
  redirect_to(new)
end
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to