Shilpi Agrawal Posted on Sep 12, 2020 • Edited on Feb 14, 2023 One liner to fetch the value from hash in Ruby. #rails #ruby Tips and Tricks of Ruby and Rails. (4 Part Series) 1 One liner to fetch the value from hash in Ruby. 2 send() in ruby to call dynamic methods 3 Rails notes 😱 4 delegate_to in Rails Struggling with fetching values from nested hash and looking for one liner, to get the work done. Here, is something really fun I have found. Have a look at it. Have fun using it. And don't forget to drop some love and comment. Top comments (2) Subscribe Submit Preview Dismiss Collapse Expand Rahul Rahul Rahul Follow Location Bangalore, India Work Software Engineer Joined Nov 4, 2019 • Sep 22 '20 Dropdown menu Copy link Hide Pro Tip: Use safe navigation to handle nil case cat&.dig(:breed, :persian_cat, :name) Collapse Expand Shilpi Agrawal Shilpi Agrawal Shilpi Agrawal Follow Internet Addict | Open Source lover & Contributor | Freelancer. Location India Work Software Engineer at Freelancer Joined Aug 17, 2020 • Sep 23 '20 Dropdown menu Copy link Hide Thanks! Rahul, thats helpful. Code of Conduct • Report abuse
Top comments (2)
Pro Tip:
Use safe navigation to handle
nilcaseThanks! Rahul, thats helpful.