On 9 November 2012 13:44, Tommaso Visconti <[email protected]> wrote:
> I have a related question.
> I was suggesting Erwin to use just:
>
> sign_me(@user, :event => :authentication #?, :subdomain => subdomain)
>
> because if subdomain is nil, sign_me should correctly handle it.
> I mean, in an hypothetical sign_in method I'd write:
>
> def sign_me(user, options)
> if options[:subdomain]
> # do_something
> end
> end
>
> if subdomain is nil the method handles it correctly.
That is the way I would do it.
Colin
> but with this code:
>
> def sign_me(user, options)
> if options.has_key? :subdomain
> # do_something
> end
> end
>
> this goes wrong ("options.has_key? :subdomain" is true)! So I'd say the
> first implementation seems more correct, do you agree with me or I' missing
> something important about checking hash parameters?
>
>
> --
> 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 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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.