Ruby on rails: replace camel case with space

ruby, ruby-on-rails

Solution

»  'camelCase'.underscore.humanize.upcase
=> "CAMEL CASE"

Problem

I want to convert camel case words like `camelCase` to `CAMEL CASE`. I tried the approach mentioned here. ``` @q = params[:promo].underscore.humanize.upcase ``` But this gives me `CAMELCASE` and not `CAMEL CASE` same result on using: ``` @q = params[:promo].gsub(/[a-zA-Z](?=[A-Z])/, '\0 ').downcase ``` EDIT: the url contains `/camelCase` but on using params[:promo], the camel case is not retained and @q is `camelcase`

Original source

Related problems