Question: In our controller, we are trying to show a video series, which should return JSON similar to this:

```
{
  id:   1,
  name: "Series Name",
  videos: [
    id:           2,
    name:         "Video Name",
    isInPlaylist: true,
    isFavorite:   false
  ]
}

```

We are adding the isInPlaylist and isInFavorite attributes via another table where we store data if a user has acted upon a video (rated it, favorited it, etc.).

```
videos = series.videos
           .where('videos.is_live = true')
           .joins("some join to user_videos join_table")
            .select(
               'videos.*,
               coalesce(user_videos.rating, 0.0) as user_rating,
               coalesce(user_videos.enqueue, \'false\') as isInPlaylist,
               coalesce(user_videos.favorite, \'false\') as isFavorite'
             )

```

Note that in our select statement those attributes are explicitly aliased as camel-cased values. However when we execute this query, these attributes are returned lower case instead:

```
{
  isinplaylist: true,
  isfavorite:   false
}

```

Answer: 
Wrapping the alias in double quotes preserves case-sensitivity. 

`.select('foo as Bar') # => { bar: true }`

`.select('foo as "Bar"') # => { Bar: true }`

The change to lower case is not an issue with the Rails `.select()` method but is enforced by the DB, in our case PostgreSQL, and is a practice called "Folding". Its worth noting that while PSQL will fold to lowercase letters, mySQL will fold to upper case letters.

I would argue however that it should still be included in the Rails API docs
¯\\_(ツ)\_/¯
I like you answer. The behaviour you see is rails default. As an alternative and 
a more classic 'rails way' would be to use a json serializing library like [jBuilder](https://github.com/rails/jbuilder#faster-json-backends). It gives you lot more control over your API but your problem would be easy to fix in that using: 

```
json.key_format! camelize: :lower
json.first_name 'David'

# => { "firstName": "David" }

```

To use something like this you would alias the columns as `is_in_playlist` format. 

Here's a good place to start with jBuilder learning: 

<http://railscasts.com/episodes/320-jbuilder>

Good tutorial on more json serializers: 

<http://railscasts.com/episodes/409-active-model-serializers>