Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
veNJOB
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
2
Merge Requests
2
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
Thanh Hung Pham
veNJOB
Commits
b6201f91
Commit
b6201f91
authored
Jul 24, 2017
by
Thanh Hung Pham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix comment - move method to model
parent
5293c7ae
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
app/helpers/cities_helper.rb
+0
-3
app/models/area.rb
+4
-0
app/views/cities/show.html.erb
+1
-1
No files found.
app/helpers/cities_helper.rb
View file @
b6201f91
module
CitiesHelper
module
CitiesHelper
def
get_city_by_area
(
area
)
City
.
where
(
area:
area
)
end
end
end
app/models/area.rb
View file @
b6201f91
...
@@ -2,4 +2,8 @@ class Area < ApplicationRecord
...
@@ -2,4 +2,8 @@ class Area < ApplicationRecord
has_many
:city
has_many
:city
validates
:name
,
presence:
true
validates
:name
,
presence:
true
def
self
.
get_city_by_area
(
area
)
City
.
where
(
area:
area
)
end
end
end
app/views/cities/show.html.erb
View file @
b6201f91
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<div
class=
"well"
>
<div
class=
"well"
>
<h3>
<%=
area
.
name
%>
</h3>
<h3>
<%=
area
.
name
%>
</h3>
<div
class=
"row"
>
<div
class=
"row"
>
<%-
get_city_by_area
(
area
).
each
do
|
city
|
-%>
<%-
Area
.
get_city_by_area
(
area
).
each
do
|
city
|
-%>
<%-
if
city
.
job
.
count
>
0
-%>
<%-
if
city
.
job
.
count
>
0
-%>
<div
class=
"col-md-4"
>
<div
class=
"col-md-4"
>
<%=
link_to
city
.
name
,
jobs_show_path
(
city_id:
city
.
id
)
%>
<%=
link_to
city
.
name
,
jobs_show_path
(
city_id:
city
.
id
)
%>
...
...
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