messages weren't being displayed in order

This commit is contained in:
Connor Turland 2016-03-01 12:55:00 +13:00
parent 26025d6ee9
commit 616dc9ed0e

View file

@ -63,7 +63,7 @@ class MapsController < ApplicationController
object = m.mappable object = m.mappable
!object || (object.permission == "private" && (!authenticated? || (authenticated? && @current.id != object.user_id))) !object || (object.permission == "private" && (!authenticated? || (authenticated? && @current.id != object.user_id)))
} }
@allmessages = @map.messages @allmessages = @map.messages.sort_by(&:created_at)
respond_with(@allmappers, @allmappings, @allsynapses, @alltopics, @allmessages, @map) respond_with(@allmappers, @allmappings, @allsynapses, @alltopics, @allmessages, @map)
} }
@ -97,7 +97,7 @@ class MapsController < ApplicationController
@json['synapses'] = @allsynapses @json['synapses'] = @allsynapses
@json['mappings'] = @allmappings @json['mappings'] = @allmappings
@json['mappers'] = @allmappers @json['mappers'] = @allmappers
@json['messages'] = @map.messages @json['messages'] = @map.messages.sort_by(&:created_at)
respond_to do |format| respond_to do |format|
format.json { render json: @json } format.json { render json: @json }