diff options
author | re4k <re4k@re4k.info> | 2013-05-01 00:44:49 +0900 |
---|---|---|
committer | re4k <re4k@re4k.info> | 2013-05-01 00:44:49 +0900 |
commit | bcf546c1f5fc305a1b75dfa091630c68668cd590 (patch) | |
tree | bd6a3754a3a5b428a4da6de213691955055c2536 /app | |
parent | 84a132e63ea44819ba60b09ed6585ac4c7b52f5b (diff) | |
download | aclog-bcf546c1f5fc305a1b75dfa091630c68668cd590.tar.gz |
fix small problems
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/application_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/errors_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/i_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/tweets_controller.rb | 7 | ||||
-rw-r--r-- | app/models/retweet.rb | 3 | ||||
-rw-r--r-- | app/views/tweets/show.html.haml | 2 |
6 files changed, 14 insertions, 5 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 diff --git a/app/models/retweet.rb b/app/models/retweet.rb index e57f4d8..7fec690 100644 --- a/app/models/retweet.rb +++ b/app/models/retweet.rb @@ -20,7 +20,8 @@ class Retweet < ActiveRecord::Base def self.from_tweet_object(status) User.from_user_object(status.user) - Tweet.from_tweet_object(status.retweeted_status) + # Tweet.from_tweet_object(status.retweeted_status) + # TODO: URL format... from_hash(id: status.id, user_id: status.user.id, tweet_id: status.retweeted_status.id) diff --git a/app/views/tweets/show.html.haml b/app/views/tweets/show.html.haml new file mode 100644 index 0000000..0cc1298 --- /dev/null +++ b/app/views/tweets/show.html.haml @@ -0,0 +1,2 @@ +.tweets + = render partial: "shared/partial/tweet", locals: {tweet: @tweet} |