Mohamed, I don't believe that's correct. And testing it out by replacing the HashWithIndifferentAccess with a regular Ruby Hash gives the expected result, so it's definitely different behavior than expected.
That being said, I just tested it on Rails 4.2.3 and it works as expected, so I'm not sure why Yves is seeing a different result. On Tue, Sep 1, 2015 at 12:14 PM, Mohamed Wael Khobalatte < [email protected]> wrote: > You are not storing waldo where you think you are storing it. On first > access `@store[:foo]` is already initialized, so it does away with your > waldo assignment, then on second and third access you are populating it. > `my_hash[:baz]` is `@store[:foo][:baz]`. > > On Tue, Sep 1, 2015 at 12:29 PM, Yves-Eric <[email protected]> wrote: > >> Hi all, >> >> >> I think I have stumbled upon a bug in HashWithIndifferentAccess. >> I cannot pinpoint it exactly, but I have written a small test case that >> exhibits the buggy behavior: >> >> https://gist.github.com/yemartin/54db7476aa41b85e7eb8 >> >> The same code works fine if we use a regular Hash for `@store` instead of >> a HashWithIndifferentAccess. >> Is this a known issue or should I fill a bug report? >> >> >> Thank you, >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" 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]. >> Visit this group at http://groups.google.com/group/rubyonrails-core. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Wael Khobalatte > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" 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]. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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]. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
