Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rendezvous
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VeNtura
rendezvous
Commits
db9ac8e7
Commit
db9ac8e7
authored
Nov 09, 2014
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conform to rubocop
parent
8771f238
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
10 deletions
+9
-10
app/controllers/posts_controller.rb
+1
-1
app/controllers/tags_controller.rb
+1
-1
app/models/post.rb
+7
-7
app/models/user.rb
+0
-1
No files found.
app/controllers/posts_controller.rb
View file @
db9ac8e7
...
@@ -45,7 +45,7 @@ class PostsController < ApplicationController
...
@@ -45,7 +45,7 @@ class PostsController < ApplicationController
gflash
error:
'Gmail authentication expired.'
gflash
error:
'Gmail authentication expired.'
redirect_to
root_path
(
id:
@post
.
id
)
redirect_to
root_path
(
id:
@post
.
id
)
rescue
ArgumentError
=>
err
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
)
redirect_to
root_path
(
id:
@post
.
id
)
end
end
...
...
app/controllers/tags_controller.rb
View file @
db9ac8e7
...
@@ -60,7 +60,7 @@ class TagsController < ApplicationController
...
@@ -60,7 +60,7 @@ class TagsController < ApplicationController
@tag
.
move_all_posts_to!
(
@merge_to_tag
)
@tag
.
move_all_posts_to!
(
@merge_to_tag
)
@tag
.
delete
@tag
.
delete
gflash
success:
"「
#{
@tag
.
name
}
」は「
#{
@merge_to_tag
.
name
}
」にmergeされました"
gflash
success:
"「
#{
@tag
.
name
}
」は「
#{
@merge_to_tag
.
name
}
」にmergeされました"
render
json:
{
status:
'OK'
}
render
json:
{
status:
'OK'
}
end
end
...
...
app/models/post.rb
View file @
db9ac8e7
...
@@ -91,13 +91,13 @@ class Post < ActiveRecord::Base
...
@@ -91,13 +91,13 @@ class Post < ActiveRecord::Base
# Class method
# Class method
######################################################################
######################################################################
def
self
.
most_pv_in_this_week
(
limit
)
def
self
.
most_pv_in_this_week
(
limit
)
posts_with_footprints
=
where
(
arel_table
[
:created_at
].
gt
1
.
week
.
ago
)
.
posts_with_footprints
=
where
(
arel_table
[
:created_at
].
gt
1
.
week
.
ago
)
select
(
"posts.id, count(footprints.id) AS footprints_count"
).
.
select
(
'posts.id, count(footprints.id) AS footprints_count'
)
joins
(
:footprints
).
.
joins
(
:footprints
)
group
(
"posts.id"
).
.
group
(
'posts.id'
)
order
(
"footprints_count DESC"
).
.
order
(
'footprints_count DESC'
)
limit
(
limit
)
.
limit
(
limit
)
posts
=
self
.
find
(
posts_with_footprints
.
map
(
&
:id
))
posts
=
find
(
posts_with_footprints
.
map
(
&
:id
))
posts
.
to_a
.
zip
posts_with_footprints
.
map
(
&
:footprints_count
)
posts
.
to_a
.
zip
posts_with_footprints
.
map
(
&
:footprints_count
)
end
end
...
...
app/models/user.rb
View file @
db9ac8e7
...
@@ -58,7 +58,6 @@ class User < ActiveRecord::Base
...
@@ -58,7 +58,6 @@ class User < ActiveRecord::Base
scope
:now_viewing
,
->
{
joins
(
:footprints
).
where
(
'footprints.updated_at > ?'
,
10
.
minutes
.
ago
)
}
scope
:now_viewing
,
->
{
joins
(
:footprints
).
where
(
'footprints.updated_at > ?'
,
10
.
minutes
.
ago
)
}
######################################################################
######################################################################
# Validations
# Validations
######################################################################
######################################################################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment