[Rails] Re: adding key/value pairs to hash wrongfully adds a right bracket

2011-10-28 Thread John Merlino
thanks for response, code was an integer, and :code was just a key of the session hash. But I decided in end to make this database backed. On Oct 23, 3:19 pm, Dave Aronson googlegroups2d...@davearonson.com wrote: On Mon, Oct 17, 2011 at 17:27, John Merlino stoici...@aol.com wrote: THis line of

[Rails] Re: adding key/value pairs to hash wrongfully adds a right bracket

2011-10-19 Thread John Merlino
thanks for response. I see what you are trying to say, but this line right here: s_code {unit_id = unit_id_hash} it just creates a hash like this: {unit_id = {}} and then latter we insert items into it, always the same way, whether it's the first time we insert item or not: unit_id_hash[key]

Re: [Rails] Re: adding key/value pairs to hash wrongfully adds a right bracket

2011-10-19 Thread Colin Law
On 19 October 2011 16:08, John Merlino stoici...@aol.com wrote: thanks for response. I see what you are trying to say, but this line right here: s_code {unit_id = unit_id_hash} it just creates a hash like this: {unit_id = {}} Open a rails console and enter code that illustrates the

[Rails] Re: adding key/value pairs to hash wrongfully adds a right bracket

2011-10-18 Thread Frederick Cheung
On Oct 17, 10:27 pm, John Merlino stoici...@aol.com wrote: Hey all, THis line of code gets called multiple times and creates a hash:   def session_code(unit_id, code)     s_code = session[:code]     unit_id_hash = s_code.detect {|h| h[unit_id]}     if unit_id_hash.nil?      

[Rails] Re: adding key/value pairs to hash wrongfully adds a right bracket

2011-10-17 Thread Tim Shaffer
How do you call the session_code method? What data type are unit_id and code? And what does a typical session[:code] look like? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit