On Mar 21, 8:19 pm, Greg Willits <[email protected]> wrote:
> Rails 3.0.5
> Code that runs fine in 1.8.7 is balking in 1.9.2
>
> I guess 1.9 has fundamentally changed something like this (assuming keys
> are symbols):
>
> my_hash.each do |key, value|
>   my_hash[key.to_s] = value
> end

Modifying a collection while enumerating over it has always been a
dangerous way to live (do you want stringify_keys (from Active
Support) ?)

>
> to now require something like this:
>
> my_hash.dup.each do |key, value|
>   my_hash[key.to_s] = my_hash.delete(key)
> end
>
> However, I am getting the error at this simple line (the first line in a
> little method to stuff params with some values):
>
> params[:search_form] ||= {}
>

What error?

Fred
> There is no iteration.
>
> Even changing it to this didn't help. Didn't really think it would, but
> tried it anyway.
>
> if !params.has_key?(:search_form)
>   params.store(:search_form, {})
> end
>
> Anyone know what the deal is here? Thanks.
>
> --
> Posted viahttp://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