On May 28, 11:44 am, Ale Ds <li...@ruby-forum.com> wrote:
> I need to convert the user_param HashWithIndifferentAccess in simple
> Hash (to convert it in YAML)
>
> I noticed a weird behavior:
>
> Why if I use (in a controller):
> user_params = (params[:user_param].to_hash)
>
> user_params is a Hash
> as I expected
>
> and if I use:
>
> user_params = (params[:user_param]) and (params[:user_param].to_hash)
>
and has very low precedence, so ruby actually treats this as
(user_params = (params[:user_param])) and
(params[:user_param].to_hash)
&& on the other hand binds more tightly and would do what you expect.
Fred
--
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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment