creating fallback for sad code
Contact me at LinkedIn  RailsZilla at Facebook  RailsZilla at twitter   google +1  Contact me at Xing  connect me at github

creating fallback for sad code

Posted in Rails

You can use rescue to create a fallback scenario, when your code gets strange… Just return a value to rescue. Our example will show it as follows: First we create a hash with a key/value pair and store it in h 1h = { :age => 35 } Now let’s bother our script with a […]

Tags: , , ,

Convert two dimensional array into hash

Posted in Ruby

A friend asked me how to transform a two dimensional array into a hash … Thats not allways easy. The reason is, that not every array accomplishes and meet the criteria of a key-value pair, which we call hash. So the well known commands like 12number.to_s float.to_i can not be extendet to a method like […]

Tags: , ,

Copyright © 2011-2018  - RailsZilla – Ruby on Rails tutorials, tips and tricks All rights reserved. | Imprint | Privacy