On 3 February 2014 10:50, Arun kant sharma <[email protected]> wrote: > Sorry for off topic reply, but how do you quote code using gmail? or I > should use web interface for posting in group.
Click on the three dots on the bottom left of the input text window to expand the text. Colin > > > On Mon, Feb 3, 2014 at 3:23 PM, Frederick Cheung > <[email protected]> wrote: >> >> >> >> On Monday, February 3, 2014 9:36:25 AM UTC, Роман Ярыгин wrote: >>> >>> Now, when I refresh the page every time, the array pops one by one item >>> and finally get empty! But, why? Why the constant changes, not variable? >>> What I'm doing wrong? >> >> >> What is constant is that ItServiceJob::TYPES always gives you the same >> object (in terms of it object_id), but there is nothing to stop you >> modifying the object. >> >> Furthermore, job_types = ITServiceJob::TYPES isn't copying >> ItServiceJob::TYPES, it is just creating a local variable that references >> the exact same ruby object. You can copy the array with .dup (this is a >> shallow copy). If you want to prevent modifications to an object you need to >> freeze it (by calling .freeze on it). After this any attempts to modify the >> object will raise an exception >> >> Fred >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/rubyonrails-talk/a88c6898-929c-4cf2-b281-3b98217e5bd6%40googlegroups.com. >> >> For more options, visit https://groups.google.com/groups/opt_out. > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/CAGHQMcibCKKG_nC%3Dwhc%2BY8WT%3DFbz6cxydm%3D3721Fc5oodc0U3A%40mail.gmail.com. > > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLv20zw9G2jf6goe-X2g7EPx5VBTqJayYqGWG33XEDhRPg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.

