Commit db9ac8e7 by tady

conform to rubocop

parent 8771f238
......@@ -45,7 +45,7 @@ class PostsController < ApplicationController
gflash error: 'Gmail authentication expired.'
redirect_to root_path(id: @post.id)
rescue ArgumentError => err
gflash error: "Mail format is invalid: #{err.to_s}"
gflash error: "Mail format is invalid: #{err}"
redirect_to root_path(id: @post.id)
end
......
......@@ -60,7 +60,7 @@ class TagsController < ApplicationController
@tag.move_all_posts_to!(@merge_to_tag)
@tag.delete
gflash success: "「#{@tag.name}」は「#{@merge_to_tag.name}」にmergeされました"
gflash success: "「#{@tag.name}」は「#{@merge_to_tag.name}」にmergeされました"
render json: { status: 'OK' }
end
......
......@@ -91,13 +91,13 @@ class Post < ActiveRecord::Base
# Class method
######################################################################
def self.most_pv_in_this_week(limit)
posts_with_footprints = where(arel_table[:created_at].gt 1.week.ago).
select("posts.id, count(footprints.id) AS footprints_count").
joins(:footprints).
group("posts.id").
order("footprints_count DESC").
limit(limit)
posts = self.find(posts_with_footprints.map(&:id))
posts_with_footprints = where(arel_table[:created_at].gt 1.week.ago)
.select('posts.id, count(footprints.id) AS footprints_count')
.joins(:footprints)
.group('posts.id')
.order('footprints_count DESC')
.limit(limit)
posts = find(posts_with_footprints.map(&:id))
posts.to_a.zip posts_with_footprints.map(&:footprints_count)
end
......
......@@ -58,7 +58,6 @@ class User < ActiveRecord::Base
scope :now_viewing, -> { joins(:footprints).where('footprints.updated_at > ?', 10.minutes.ago) }
######################################################################
# Validations
######################################################################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment