Sunday, November 18, 2012

[Rails] Global variables and assigning the values

I am having an issue where the global variable, $r, which i declared in
the controller is being overwritten by my code which is in a view:

<%= link_to 'Picks test1', game_pick_page_path, :onclick => $r = 1 %>
<%= link_to 'Picks test2', game_pick_page_path, :onclick => $r = 2 %>

The first $r = 1 is overwritten by $r = 2 making the value 2 even if i
click picks test1. i want it to just set $r to which every value is
associated with the link the user clicks.

Any ideas on how to make this happen would be greatly appreciated.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate