Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
ven-job
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
Trịnh Hoàng Phúc
ven-job
Commits
a95865dc
Commit
a95865dc
authored
May 22, 2020
by
Trịnh Hoàng Phúc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean code
parent
ee707e8a
Pipeline
#635
failed with stages
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
app/controllers/jobs_controller.rb
+1
-1
app/models/job.rb
+3
-1
No files found.
app/controllers/jobs_controller.rb
View file @
a95865dc
...
@@ -12,7 +12,7 @@ class JobsController < ApplicationController
...
@@ -12,7 +12,7 @@ class JobsController < ApplicationController
@jobs
=
Job
.
by_companies
(
params
[
:company_id
]).
page
(
params
[
:page
])
@jobs
=
Job
.
by_companies
(
params
[
:company_id
]).
page
(
params
[
:page
])
@amount_job
=
Job
.
by_companies
(
params
[
:company_id
]).
count
@amount_job
=
Job
.
by_companies
(
params
[
:company_id
]).
count
else
else
@jobs
=
Job
.
order
(
"id DESC"
).
page
(
params
[
:page
])
@jobs
=
Job
.
order
(
id: :desc
).
page
(
params
[
:page
])
@amount_job
=
Job
.
count
@amount_job
=
Job
.
count
end
end
end
end
...
...
app/models/job.rb
View file @
a95865dc
...
@@ -34,6 +34,8 @@ class Job < ApplicationRecord
...
@@ -34,6 +34,8 @@ class Job < ApplicationRecord
end
end
def
self
.
related_jobs
(
company_id
,
job_id
)
def
self
.
related_jobs
(
company_id
,
job_id
)
@related_jobs
||=
includes
(
:cities
,
:company
).
where
(
"company_id =
#{
company_id
}
and id !=
#{
job_id
}
"
).
order
(
id: :desc
).
limit
(
10
)
@related_jobs
||=
includes
(
:cities
,
:company
).
where
.
not
(
id:
job_id
)
.
where
(
company_id:
company_id
)
.
limit
(
10
)
end
end
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