diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index fd44c546..a19e889b 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -11,7 +11,7 @@ class MainController < ApplicationController @maps = Map.visibleToUser(@current, nil) @map = @maps.sample - @mapjson = @map.self_as_json(@current).html_safe + @mapjson = @map.self_as_json(@current).html_safe if @map respond_to do |format| format.html { respond_with(@map, @user) } diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 29e638ea..f463429c 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -23,9 +23,14 @@ class SessionsController < ApplicationController @user = User.new @connor = User.find(555629996) - @map = Map.find(5) + @map = Map.find(:first, 5) - respond_with(@user, @session, location: user_map_url(@connor,@map)) do |format| + if @map + respond_with(@user, @session, location: user_map_url(@connor,@map)) do |format| + end + else + respond_with(@user, @session, location: root_url) do |format| + end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 821e3643..cd46ebd4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -40,9 +40,14 @@ class UsersController < ApplicationController # direct them straight to the metamaps manual map. @connor = User.find(555629996) - @map = Map.find(5) + @map = Map.find(:first, 5) - respond_with(@user, location: user_map_url(@connor,@map)) do |format| + if @map + respond_with(@user, location: user_map_url(@connor,@map)) do |format| + end + else + respond_with(@user, location: root_url) do |format| + end end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6fd8a97a..dc3a1260 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -65,7 +65,7 @@