From a295c61322efdb0384ec3b9203b655321eb7bdca Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sat, 12 Mar 2016 12:58:13 +1100 Subject: [PATCH] json response was broken --- app/controllers/main_controller.rb | 2 +- app/controllers/maps_controller.rb | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index 363c9c94..7bc22c7e 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -13,7 +13,7 @@ class MainController < ApplicationController @maps = policy_scope(Map).order("updated_at DESC").page(1).per(20) respond_to do |format| format.html { - if authenticated? + if not authenticated? render 'main/home' else render 'maps/activemaps' diff --git a/app/controllers/maps_controller.rb b/app/controllers/maps_controller.rb index 83f7cb89..d45c1432 100644 --- a/app/controllers/maps_controller.rb +++ b/app/controllers/maps_controller.rb @@ -13,11 +13,12 @@ class MapsController < ApplicationController @maps = policy_scope(Map).order("updated_at DESC") .page(page).per(20) - # root url => main/home. main/home renders maps/activemaps view. - redirect_to root_url and return if authenticated? - respond_to do |format| - format.html { respond_with(@maps, @user) } + format.html { + # root url => main/home. main/home renders maps/activemaps view. + redirect_to root_url and return if authenticated? + respond_with(@maps, @user) + } format.json { render json: @maps } end end @@ -81,7 +82,7 @@ class MapsController < ApplicationController respond_with(@allmappers, @allmappings, @allsynapses, @alltopics, @map) } - format.json { render json: @map.as_json } + format.json { render json: @map } end end