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).
There is a Rails inbuilt method called 'underscore' that you can use for this purpose

```
"CamelCaseString".underscore #=> "camel_case_string" 

```

The 'underscore' method can typically be considered as inverse of 'camelize'