You can use fetches or default block to clean up that code without doing a
dangerous monkey-patch like you are suggesting.
Consider:
hash.fetch(:data, {}).fetch(:details, {})[:id]
On Sun, Jul 27, 2014 at 11:48 AM, Steve Klabnik <[email protected]>
wrote:
> This has a very large potential to break a very, very large amount of code.
>
> --
> 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.
>
--
Daniel Evans
--
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.