I have a dynamic select of states and cities and my idea is to list the state capital first selected.
I have the following code to list the cities but that is not listing the capital first:
@cidades = Cidade.where("estado_id = ?", Estado.first.id).order(id: Estado.select(:capital))
remembering that the capital is an attribute of the state table of type integer