In Ruby what is the meaning of colon after identifier in a Hash?

hash, ruby, syntax

Solution

The colon in this context denotes a literal Hash.

`factory` is the `Hash` key, `:user` is the value.

The alternative syntax is `:factory => :user`. They mean the same thing.

Problem

I'm learning about Factory Girl and I saw this code: ``` factory :post do association :author, factory: :user, last_name: "Writely" end ``` why do `factory` and `last_name` have a colon at their end?

Original source