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
e3abbf72
Commit
e3abbf72
authored
Nov 10, 2014
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conform to rubocop
parent
b5e7af71
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
7 deletions
+2
-7
app/decorators/post_decorator.rb
+1
-3
app/models/tag.rb
+1
-4
No files found.
app/decorators/post_decorator.rb
View file @
e3abbf72
...
@@ -48,8 +48,6 @@ class PostDecorator < Draper::Decorator
...
@@ -48,8 +48,6 @@ class PostDecorator < Draper::Decorator
end
end
def
thumbnail_url
def
thumbnail_url
if
model
.
body
=~
/!\[.+?\]\((.+?)\)/
return
Regexp
.
last_match
[
1
]
if
model
.
body
=~
/!\[.+?\]\((.+?)\)/
return
$1
end
end
end
end
end
app/models/tag.rb
View file @
e3abbf72
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
#
#
class
Tag
<
ActiveRecord
::
Base
class
Tag
<
ActiveRecord
::
Base
# for tree structure
# for tree structure
has_ancestry
has_ancestry
...
@@ -41,7 +40,6 @@ class Tag < ActiveRecord::Base
...
@@ -41,7 +40,6 @@ class Tag < ActiveRecord::Base
order
(
created_at: :desc
).
limit
(
limit
)
order
(
created_at: :desc
).
limit
(
limit
)
end
)
end
)
######################################################################
######################################################################
# Class method
# Class method
######################################################################
######################################################################
...
@@ -70,7 +68,7 @@ class Tag < ActiveRecord::Base
...
@@ -70,7 +68,7 @@ class Tag < ActiveRecord::Base
tags_this_month_with_score
[
tag_id
]
=
this_month_count
.
to_f
/
(
tags_last_month
[
tag_id
]
+
1
)
tags_this_month_with_score
[
tag_id
]
=
this_month_count
.
to_f
/
(
tags_last_month
[
tag_id
]
+
1
)
end
end
sorted
=
tags_this_month_with_score
.
sort_by
{
|
k
,
v
|
-
v
}.
take
(
limit
).
to_h
sorted
=
tags_this_month_with_score
.
sort_by
{
|
_
k
,
v
|
-
v
}.
take
(
limit
).
to_h
Tag
.
find
(
sorted
.
keys
).
to_a
.
zip
(
sorted
.
values
).
to_h
Tag
.
find
(
sorted
.
keys
).
to_a
.
zip
(
sorted
.
values
).
to_h
end
end
...
@@ -80,7 +78,6 @@ class Tag < ActiveRecord::Base
...
@@ -80,7 +78,6 @@ class Tag < ActiveRecord::Base
# Instance method
# Instance method
######################################################################
######################################################################
def
recent_posts
(
limit
=
30
)
def
recent_posts
(
limit
=
30
)
posts
.
recent
(
limit
)
posts
.
recent
(
limit
)
end
end
...
...
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