aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorre4k <re4k@re4k.info>2013-05-01 00:44:49 +0900
committerre4k <re4k@re4k.info>2013-05-01 00:44:49 +0900
commitbcf546c1f5fc305a1b75dfa091630c68668cd590 (patch)
treebd6a3754a3a5b428a4da6de213691955055c2536 /app/controllers
parent84a132e63ea44819ba60b09ed6585ac4c7b52f5b (diff)
downloadaclog-bcf546c1f5fc305a1b75dfa091630c68668cd590.tar.gz
fix small problems
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/application_controller.rb2
-rw-r--r--app/controllers/errors_controller.rb1
-rw-r--r--app/controllers/i_controller.rb4
-rw-r--r--app/controllers/tweets_controller.rb7
4 files changed, 10 insertions, 4 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 2c73623..66534fa 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -6,7 +6,7 @@ class ApplicationController < ActionController::Base
def _get_user(id, screen_name)
if id
- User.find_by(id: id.to_i)
+ User.find_by(id: id)
elsif screen_name
User.find_by(screen_name: screen_name)
end
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb
index f7087fa..fe3b7b2 100644
--- a/app/controllers/errors_controller.rb
+++ b/app/controllers/errors_controller.rb
@@ -22,7 +22,6 @@ class ErrorsController < ApplicationController
when ActionController::RoutingError
render "error", status: 404
else
- warn @exception
render "error", status: 500
end
end
diff --git a/app/controllers/i_controller.rb b/app/controllers/i_controller.rb
index 9a7f4d8..cfd28c9 100644
--- a/app/controllers/i_controller.rb
+++ b/app/controllers/i_controller.rb
@@ -1,5 +1,5 @@
class IController < ApplicationController
- # GET /api/tweets/import
+ # GET /i/import
def import
# import 100
if session[:account]
@@ -7,5 +7,7 @@ class IController < ApplicationController
else
raise Aclog::Exceptions::LoginRequired
end
+
+ redirect_to tweet_path(params[:id])
end
end
diff --git a/app/controllers/tweets_controller.rb b/app/controllers/tweets_controller.rb
index e372091..e8c9ed9 100644
--- a/app/controllers/tweets_controller.rb
+++ b/app/controllers/tweets_controller.rb
@@ -89,7 +89,7 @@ class TweetsController < ApplicationController
def render(*args)
if args.empty?
if params[:action] == "show"
- super "shared/tweet"
+ super
else
super "shared/tweets"
end
@@ -111,4 +111,9 @@ class TweetsController < ApplicationController
@user_b = _get_user(params[:user_id_b], params[:screen_name_b])
raise Aclog::Exceptions::UserNotFound unless @user_b
end
+
+ def tweet_required
+ @tweet = Tweet.find_by(id: params[:id])
+ raise Aclog::Exceptions::TweetNotFound unless @tweet
+ end
end