aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorrhenium <re4k@re4k.info>2013-05-18 22:07:46 +0900
committerrhenium <re4k@re4k.info>2013-05-18 22:07:46 +0900
commitc91bc3a5234fc02cfeaec7d1678af8c30a15e5a2 (patch)
treef473db29778b23071f67e33fe41182a8264a2d4c /app/controllers/application_controller.rb
parent28ef1eda1cb1d0810a49fbbacee5d7628e531001 (diff)
downloadaclog-c91bc3a5234fc02cfeaec7d1678af8c30a15e5a2.tar.gz
fix routing
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index d23f78a..029aba9 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -11,12 +11,12 @@ class ApplicationController < ActionController::Base
if id
User.find(id) rescue raise Aclog::Exceptions::UserNotFound
elsif screen_name
- User.find_by(screen_name: screen_name) || (raise Aclog::Exceptions::UserNotFound)
+ User.find_by(screen_name: screen_name) or raise Aclog::Exceptions::UserNotFound
end
end
def authorized_to_show?(user)
- return true if not user.protected?
+ return true unless user.protected?
if session[:user_id]
return session[:user_id] == user.id || session[:account].following?(user.id)
@@ -36,8 +36,12 @@ class ApplicationController < ActionController::Base
private
def check_format
- unless [:json, :html].include?(request.format.to_sym)
- raise ActionController::RoutingError, "Not supported format: #{request.format}"
+ unless request.format == :html || request.format == :json
+ if params[:format] == nil
+ request.format = :html
+ else
+ raise ActionController::RoutingError, "Not supported format: #{request.format}"
+ end
end
end