Question: Is there any ready function which converts camel case Strings into underscore separated string?

I want something like this:

```
"CamelCaseString".to_underscore      

```

to return "camel\_case\_string".

...

Answer: 
You can use 

```
"CamelCasedName".tableize.singularize

```

Or just

```
"CamelCasedName".underscore

```

Both options ways will yield `"camel_cased_name"`. You can check more details it [here](http://api.rubyonrails.org/classes/String.html#method-i-underscore).
Here's how [Rails does it](http://rails.rubyonrails.org/classes/Inflector.html#M001631):

```
   def underscore(camel_cased_word)
     camel_cased_word.to_s.gsub(/::/, '/').
       gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
       gsub(/([a-z\d])([A-Z])/,'\1_\2').
       tr("-", "_").
       downcase
   end

```