Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MIS21FinalsElection
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dean Krisitan Bardeloza
MIS21FinalsElection
Commits
2cc6b35b
Commit
2cc6b35b
authored
Jul 20, 2016
by
Bianca Tarun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added party list feature
parent
4013142a
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
322 additions
and
112 deletions
+322
-112
candidates_controller.rb
Election/app/controllers/admin/candidates_controller.rb
+1
-2
party_lists_controller.rb
Election/app/controllers/admin/party_lists_controller.rb
+53
-0
positions_controller.rb
Election/app/controllers/admin/positions_controller.rb
+3
-2
candidates_controller.rb
Election/app/controllers/candidates_controller.rb
+9
-0
pages_controller.rb
Election/app/controllers/pages_controller.rb
+4
-0
party_lists_controller.rb
Election/app/controllers/party_lists_controller.rb
+8
-0
votes_controller.rb
Election/app/controllers/votes_controller.rb
+28
-48
candidate.rb
Election/app/models/candidate.rb
+1
-0
party_list.rb
Election/app/models/party_list.rb
+4
-0
_form.html.erb
Election/app/views/admin/candidates/_form.html.erb
+1
-0
show.html.erb
Election/app/views/admin/candidates/show.html.erb
+2
-1
_form.html.erb
Election/app/views/admin/party_lists/_form.html.erb
+5
-0
edit.html.erb
Election/app/views/admin/party_lists/edit.html.erb
+5
-0
index.html.erb
Election/app/views/admin/party_lists/index.html.erb
+25
-0
new.html.erb
Election/app/views/admin/party_lists/new.html.erb
+5
-0
show.html.erb
Election/app/views/admin/party_lists/show.html.erb
+9
-0
index.html.erb
Election/app/views/candidates/index.html.erb
+12
-0
index.html.erb
Election/app/views/pages/index.html.erb
+28
-16
index.html.erb
Election/app/views/party_lists/index.html.erb
+13
-0
_form.html.erb
Election/app/views/votes/_form.html.erb
+33
-0
index.html.erb
Election/app/views/votes/index.html.erb
+0
-23
new.html.erb
Election/app/views/votes/new.html.erb
+2
-10
show.html.erb
Election/app/views/votes/show.html.erb
+4
-3
user_profile.html.erb
Election/app/views/votes/user_profile.html.erb
+5
-2
routes.rb
Election/config/routes.rb
+9
-2
20160720111124_create_party_lists.rb
Election/db/migrate/20160720111124_create_party_lists.rb
+9
-0
20160720112847_add_party_list_to_candidates.rb
...db/migrate/20160720112847_add_party_list_to_candidates.rb
+5
-0
20160720124015_add_description_to_party_lists.rb
.../migrate/20160720124015_add_description_to_party_lists.rb
+6
-0
20160720134047_add_description_to_party_lists.rb
.../migrate/20160720134047_add_description_to_party_lists.rb
+5
-0
schema.rb
Election/db/schema.rb
+14
-3
party_lists.yml
Election/test/fixtures/party_lists.yml
+7
-0
party_list_test.rb
Election/test/models/party_list_test.rb
+7
-0
No files found.
Election/app/controllers/admin/candidates_controller.rb
View file @
2cc6b35b
...
...
@@ -34,7 +34,7 @@ class CandidatesController < ApplicationController
end
def
show
@candidate
=
Candidate
.
find
(
params
[
:id
])
@party_list
=
PartyList
.
where
(
candidate_id:
(
@candidate
.
id
))
@votes
=
Vote
.
where
(
candidate_id:
(
@candidate
.
id
))
@votes_male
=
Array
.
new
@votes_female
=
Array
.
new
...
...
@@ -48,7 +48,6 @@ class CandidatesController < ApplicationController
end
def
destroy
@candidate
=
Candidate
.
find
(
params
[
:id
])
@votes
=
Vote
.
where
(
candidate_id:
(
@candidate
.
id
))
@votes
.
destroy_all
@candidate
.
destroy
...
...
Election/app/controllers/admin/party_lists_controller.rb
0 → 100644
View file @
2cc6b35b
module
Admin
class
PartyListsController
<
ApplicationController
before_action
:authenticate_user!
def
index
@party_lists
=
PartyList
.
all
render
"admin/party_lists/index.html.erb"
end
def
new
@party_list
=
PartyList
.
new
render
"admin/party_lists/new.html.erb"
end
def
create
@party_list
=
PartyList
.
new
(
party_list_params
())
if
@party_list
.
save
redirect_to
admin_party_lists_path
(
@party_list
.
id
)
else
render
"admin/party_lists/new.html.erb"
end
end
def
edit
@party_list
=
PartyList
.
find
(
params
[
:id
])
end
def
update
@party_list
=
PartyList
.
find
(
params
[
:id
])
if
@party_list
.
update
(
party_list_params
())
redirect_to
admin_party_list_path
(
@party_list
.
id
)
else
render
"admin/party_lists/edit.html.erb"
end
end
def
show
@party_list
=
PartyList
.
find
(
params
[
:id
])
@candidates
=
Candidate
.
all
render
"admin/party_lists/show.html.erb"
end
def
destroy
@party_list
=
PartyList
.
find
(
params
[
:id
])
@candidates
=
Candidate
.
where
(
party_list_id:
(
@party_list
.
id
))
@candidates
.
each
do
|
candidate
|
candidate
.
party_list
==
""
end
@party_list
.
destroy
redirect_to
admin_party_lists_path
end
def
party_list_params
params
.
require
(
:party_list
).
permit!
end
end
end
\ No newline at end of file
Election/app/controllers/admin/positions_controller.rb
View file @
2cc6b35b
...
...
@@ -36,12 +36,13 @@ class PositionsController < ApplicationController
render
"admin/positions/show.html.erb"
end
def
destroy
@position
=
Position
.
find
(
params
[
:id
])
@candidates
=
Candidate
.
where
(
position_id:
(
@position
.
id
))
@candidates
.
each
do
|
candidate
|
@votes
=
Vote
.
where
(
candidate_id:
(
candidate
.
id
))
@votes
.
destroy_all
@votes
.
destroy_all
end
@position
.
destroy
...
...
Election/app/controllers/candidates_controller.rb
0 → 100644
View file @
2cc6b35b
class
CandidatesController
<
ApplicationController
before_action
:authenticate_user!
def
index
@positions
=
Position
.
all
render
"candidates/index.html.erb"
end
end
\ No newline at end of file
Election/app/controllers/pages_controller.rb
View file @
2cc6b35b
class
PagesController
<
ApplicationController
def
index
@positions
=
Position
.
all
@party_lists
=
PartyList
.
all
render
"pages/index.html.erb"
end
def
about
render
"pages/about.html.erb"
end
end
\ No newline at end of file
Election/app/controllers/party_lists_controller.rb
0 → 100644
View file @
2cc6b35b
class
PartyListsController
<
ApplicationController
before_action
:authenticate_user!
def
index
@party_lists
=
PartyList
.
all
@candidates
=
Candidate
.
all
render
"party_lists/index.html.erb"
end
end
\ No newline at end of file
Election/app/controllers/votes_controller.rb
View file @
2cc6b35b
class
VotesController
<
ApplicationController
def
index
@votes
=
current_user
.
votes
@candidates
=
Candidate
.
all
@positions
=
Position
.
all
render
"votes/index.html.erb"
end
def
new
@positions
=
Position
.
all
@vote
=
Vote
.
new
@candidates
=
[]
@all_candidates
=
Candidate
.
pluck
(
:id
)
@candidate_voted
=
current_user
.
votes
.
pluck
(
:candidate_id
).
uniq
@all_candidates
.
each
do
|
candidate
|
@candidate_voted
.
each
do
|
voted
|
if
candidate
=
voted
@all_candidates
.
delete
(
candidate
)
end
end
end
@all_candidates
.
each
do
|
c1
|
@candidates
.
push
(
Candidate
.
find
(
c1
))
before_action
:authenticate_user!
def
index
@positions
=
Position
.
all
@votes
=
current_user
.
votes
@candidates
=
Candidate
.
all
end
if
@candidates
.
empty?
redirect_to
root_path
,
notice:
"You have already voted all candidates"
def
new
if
Vote
.
exists?
(
user:
current_user
)
redirect_to
root_path
,
alert:
"You have already voted."
else
@user
=
current_user
@user
.
votes
.
build
@positions
=
Position
.
all
render
"votes/new.html.erb"
end
end
def
create
@candidate
=
Candidate
.
find
(
vote_params
[
:candidate_id
])
@vote
=
Vote
.
new
(
vote_params
)
@vote
.
user
=
current_user
if
@vote
.
save
def
checkout
if
current_user
.
update
(
vote_params
)
redirect_to
root_path
else
render
:action
=>
'show'
@user
=
current_user
@positions
=
Position
.
all
redirect_to
vote_path
,
alert:
"Please accomplish all required fields."
end
end
def
updat
e
end
def
show
@positions
=
Position
.
all
@votes
=
current_user
.
votes
@candidates
=
Candidate
.
all
def
profil
e
if
user_signed_in?
@user
=
current_user
@votes
=
Vote
.
where
(
user_id:
(
@user
.
id
))
else
redirect_to
root_path
end
end
def
vote_params
private
def
vote_params
params
.
require
(
:vote
).
permit!
end
end
end
\ No newline at end of file
Election/app/models/candidate.rb
View file @
2cc6b35b
...
...
@@ -3,6 +3,7 @@ class Candidate < ActiveRecord::Base
validates
:last_name
,
presence:
true
validates
:slogan
,
uniqueness:
true
,
presence:
true
belongs_to
:position
belongs_to
:party_list
has_many
:votes
def
to_s
"
#{
first_name
}
#{
last_name
}
"
...
...
Election/app/models/party_list.rb
0 → 100644
View file @
2cc6b35b
class
PartyList
<
ActiveRecord
::
Base
has_many
:candidates
validates
:name
,
presence:
true
,
uniqueness:
true
end
Election/app/views/admin/candidates/_form.html.erb
View file @
2cc6b35b
...
...
@@ -2,6 +2,7 @@
<%=
f
.
input
:first_name
%>
<%=
f
.
input
:last_name
%>
<%=
f
.
input
:nickname
%>
<%=
f
.
association
:party_list
,
include_blank:
false
%>
<%=
f
.
association
:position
,
include_blank:
false
%>
<%=
f
.
input
:slogan
%>
<%=
f
.
submit
%>
...
...
Election/app/views/admin/candidates/show.html.erb
View file @
2cc6b35b
<h2>
Candidate:
<%=
@candidate
.
first_name
%>
<%=
@candidate
.
last_name
%>
</h2>
<h3>
<%=
@candidate
.
slogan
%>
</h3>
<h4>
Party List:
<%=
@candidate
.
party_list
.
name
%>
</h4>
<h3>
<%=
@candidate
.
last_name
%>
's Slogan:
<%=
@candidate
.
slogan
%>
</h3>
<ul>
<li>
Votes:
<%=
@votes_male
.
size
+
@votes_female
.
size
%>
</li>
<li>
Male Voters:
<%=
@votes_male
.
size
%>
</li>
...
...
Election/app/views/admin/party_lists/_form.html.erb
0 → 100644
View file @
2cc6b35b
<%=
simple_form_for
([
:admin
,
@party_list
])
do
|
f
|
%>
<%=
f
.
input
:name
%>
<%=
f
.
input
:description
%>
<%=
f
.
submit
%>
<%
end
%>
\ No newline at end of file
Election/app/views/admin/party_lists/edit.html.erb
0 → 100644
View file @
2cc6b35b
<h1>
Admin Edit Party List
</h1>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to Party Lists"
,
admin_party_lists_path
%>
\ No newline at end of file
Election/app/views/admin/party_lists/index.html.erb
0 → 100644
View file @
2cc6b35b
<h1>
Admin Party Lists
</h1>
<hr>
<%=
link_to
(
"New Party List"
,
new_admin_party_list_path
)
%>
<hr>
<table
width=
"100%"
>
<tr>
<th>
Name
</th>
</tr>
<%
@party_lists
.
each
do
|
p
|
%>
<tr>
<td>
<%=
p
.
name
%>
</td>
<td>
<%=
link_to
"Show"
,
admin_party_list_path
(
p
.
id
)
%>
<%=
link_to
"Edit"
,
edit_admin_party_list_path
(
p
.
id
)
%>
<%=
link_to
"Delete"
,
admin_party_list_path
(
p
.
id
),
method: :delete
,
data:
{
confirm:
'Are you sure?'
}
%>
</td>
</tr>
</table>
<ul>
<%
p
.
candidates
.
each
do
|
candidate
|
%>
<li>
<%=
candidate
.
first_name
%>
<%=
candidate
.
last_name
%>
</li>
<%
end
%>
</ul>
<%
end
%>
Election/app/views/admin/party_lists/new.html.erb
0 → 100644
View file @
2cc6b35b
<h1>
Admin New Party List
</h1>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to Party Lists"
,
admin_party_lists_path
%>
\ No newline at end of file
Election/app/views/admin/party_lists/show.html.erb
0 → 100644
View file @
2cc6b35b
<h1>
Party List:
<%=
@party_list
.
name
%>
</h1>
<hr>
<h3>
Party List Description
</h3>
<%=
@party_list
.
description
%>
<%
@party_list
.
candidates
.
each
do
|
candidate
|
%>
<ul>
<%=
candidate
.
first_name
%>
<%=
candidate
.
last_name
%>
<%
end
%>
<hr>
<%=
link_to
"Back to Party Lists"
,
admin_party_lists_path
%>
\ No newline at end of file
Election/app/views/candidates/index.html.erb
0 → 100644
View file @
2cc6b35b
<h1>
List of Candidates
</h1>
<%
@positions
.
each
do
|
p
|
%>
<h2>
<%=
p
.
name
%>
</h2>
<table>
<tr>
<th>
Full Name
</th>
</tr>
<%
p
.
candidates
.
each
do
|
candidate
|
%>
<td>
<%=
candidate
.
first_name
%>
<%=
candidate
.
last_name
%>
</td>
<%
end
%>
</table>
<%
end
%>
Election/app/views/pages/index.html.erb
View file @
2cc6b35b
<h1>
Official Election Ballot
</h1>
<%
if
user_signed_in?
%>
<h2>
Please take a look at our candidates!
</h2>
<hr>
<%
if
current_user
.
email
==
"admin_email@yahoo.com"
%>
<%=
link_to
"Manage Candidates"
,
admin_candidates_path
%>
||
<%=
link_to
"Manage Positions"
,
admin_positions_path
%>
||
<%=
link_to
"Vote"
,
votes_path
%>
<%
else
%>
<%=
link_to
"Vote"
,
votes_path
%>
<%
end
%>
<%
if
current_user
.
email
==
"admin_email@yahoo.com"
%>
<%=
link_to
"Manage Candidates"
,
admin_candidates_path
%>
||
<%=
link_to
"Manage Positions"
,
admin_positions_path
%>
||
<%=
link_to
"Manage Party Lists"
,
admin_party_lists_path
%>
||
<%=
link_to
"Vote"
,
votes_new_path
%>
||
<%=
link_to
"About"
,
pages_about_path
%>
||
<%=
link_to
"User Profile"
,
votes_user_profile_path
%>
<%
else
%>
<%=
link_to
"About"
,
pages_about_path
%>
||
<%=
link_to
"Vote"
,
votes_new_path
%>
||
<%=
link_to
"User Profile"
,
votes_user_profile_path
%>
<%
end
%>
<hr>
<h1>
List of Candidates
</h1>
<%
@positions
.
each
do
|
p
|
%>
<h2>
<%=
p
.
name
%>
</h2>
<ul>
<%
p
.
candidates
.
each
do
|
c
|
%>
<li>
<%=
link_to
c
.
nickname
,
admin_candidate_path
(
c
.
id
)
%>
</li>
<%
end
%>
</ul>
<%=
link_to
"View all Candidates"
,
"/positions/
#{
p
.
id
}
"
%>
<h2>
<%=
p
.
name
%>
</h2>
<table>
<tr>
<th>
Full Name
</th>
<th>
Number of Votes
</th>
</tr>
<%
p
.
candidates
.
each
do
|
candidate
|
%>
<td>
<%=
candidate
.
first_name
%>
<%=
candidate
.
last_name
%>
</td>
<td>
<%=
candidate
.
votes
.
count
%>
</td>
<%
end
%>
</table>
<%
end
%>
<hr>
<%=
link_to
"View all Candidates"
,
candidates_path
%>
<%=
link_to
"View all Party Lists"
,
party_lists_index_path
%>
<%
else
%>
<h4>
You are not signed in. Please
<%=
link_to
"Login"
,
new_user_session_path
%>
or
<%=
link_to
"Sign Up"
,
new_user_registration_path
%>
to proceed with voting.
</h4>
<%
end
%>
\ No newline at end of file
Election/app/views/party_lists/index.html.erb
0 → 100644
View file @
2cc6b35b
<h1>
Party Lists
</h1>
<%
@party_lists
.
each
do
|
p
|
%>
<%=
p
.
name
%>
<hr>
<h3>
Party List Description
</h3>
<%=
p
.
description
%>
<h3>
Party List Candidates
</h3>
<%
p
.
candidates
.
each
do
|
candidate
|
%>
<%=
candidate
.
first_name
%>
<%=
candidate
.
last_name
%>
<%
end
%>
<%
end
%>
<hr>
<%=
link_to
"Back to Homepage"
,
root_path
%>
\ No newline at end of file
Election/app/views/votes/_form.html.erb
0 → 100644
View file @
2cc6b35b
<h1>
Vote for your candidates.
</h1>
<%=
simple_form_for
(
@user
,
url:
checkout_path
,
method: :post
)
do
|
v
|
%>
<%
@positions
.
each
do
|
p
|
%>
<%=
v
.
simple_fields_for
:votes
do
|
f
|
%>
<h2>
<%=
p
.
name
%>
</h2>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<%=
f
.
association
:candidate
,
:collection
=>
Candidate
.
where
(
position_id:
(
p
.
id
)),
include_blank:
false
,
:label_method
=>
lambda
{
|
candidate
|
"
#{
candidate
.
last_name
}
,
#{
candidate
.
first_name
}
"
},
as: :radio_buttons
,
label:
"Candidates: "
%>
<%
Candidate
.
where
(
position_id:
(
p
.
id
)).
each
do
|
candidate
|
%>
<p><div
class=
"btn btn-primary btn-xs"
data-toggle=
"popover"
data-content=
"
<%=
candidate
.
slogan
%>
"
style=
"margin-top: 2px; margin-bottom: 1px"
,
data-trigger=
"focus"
,
role=
"button"
,
tabindex=
"0"
,
title=
"
<%=
candidate
.
first_name
%>
<%=
candidate
.
last_name
%>
"
>
View
<%=
candidate
.
last_name
%>
's Slogan
</div></p>
<%
end
-%>
</div>
<div
class=
"col-md-6"
>
<br><br><br>
</div>
</div>
<%=
f
.
input
:comments
%>
<%
end
-%>
<%
end
-%>
<%=
v
.
button
:submit
,
"Vote"
,
class:
"btn btn-primary"
%>
<%=
link_to
"Back to Homepage"
,
root_path
,
class:
"btn btn-default"
%>
<%=
link_to
"Vote Record"
,
votes_index_path
<
% end
%>
<script>
$
(
document
).
ready
(
function
(){
$
(
'[data-toggle="popover"]'
).
popover
();
});
</script>
\ No newline at end of file
Election/app/views/votes/index.html.erb
deleted
100644 → 0
View file @
4013142a
<h1>
Votes
</h1>
<%=
link_to
"Vote Now!"
,
new_vote_path
%>
<table
width=
"100%"
>
<tr>
<th>
#
</th>
<th>
User ID
</th>
<th>
Candidate
</th>
<th>
Position
</th>
</tr>
<%
@votes
.
each
do
|
vote
|
%>
<tr>
<td>
<%=
link_to
"
#{
vote
.
id
}
"
,
vote_path
(
vote
.
id
)
%>
</td>
<td>
<%=
vote
.
user_id
%>
</td>
<td>
<%=
vote
.
candidate
.
first_name
%>
"
<%=
vote
.
candidate
.
nickname
%>
"
<%=
vote
.
candidate
.
last_name
%>
</td>
<td>
<%=
vote
.
candidate
.
position
.
name
%>
</td>
</tr>
<%
end
%>
</table>
\ No newline at end of file
Election/app/views/votes/new.html.erb
View file @
2cc6b35b
<h1>
Vote
</h1>
<%=
simple_form_for
(
@vote
)
do
|
v
|
%>
<%
@positions
.
each
do
|
p
|
%>
<h2>
<%=
p
.
name
%>
</h2>
<%=
v
.
association
:candidate
,
:collection
=>
Candidate
.
where
(
position_id:
(
p
.
id
)),
include_blank:
false
%>
<%=
v
.
input
:comments
%>
<br>
<%=
render
partial:
"form"
%>
<%=
v
.
button
:submit
,
"Vote"
%>
<%
end
%>
<%
end
%>
<%=
link_to
"Back to Homepage"
,
root_path
%>
Election/app/views/votes/show.html.erb
View file @
2cc6b35b
<h1>
My
Vote Record
</h1>
<h1>
Vote Record
</h1>
<table
class=
"table"
>
<thead>
<th>
Candidate
</th>
...
...
@@ -27,5 +27,6 @@
<%
end
%>
</tbody>
</table>
<a
href=
"http://localhost:3000/votes/new"
class=
"btn btn-primary"
role=
"button"
>
Add Vote
</a>
\ No newline at end of file
<hr>
<%=
link_to
"Vote"
,
votes_path
%>
<%=
link_to
"Back to Homepage"
,
root_path
%>
\ No newline at end of file
Election/app/views/votes/user_
votes
.html.erb
→
Election/app/views/votes/user_
profile
.html.erb
View file @
2cc6b35b
<h1>
Profile Page
</h1>
<h2>
<%=
@user
.
first_name
%>
<%=
@user
.
last_name
%>
</h2>
<hr>
<table
class=
"table table-striped"
>
<thead>
<th>
Vote ID
</th>
...
...
@@ -15,4 +16,6 @@
</tr>
<%
end
%>
</tbody>
</table>
\ No newline at end of file
</table>
<hr>
Election/config/routes.rb
View file @
2cc6b35b
...
...
@@ -4,11 +4,18 @@ Rails.application.routes.draw do
namespace
:admin
do
resources
:positions
resources
:candidates
resources
:party_lists
end
resources
:candidates
resources
:positions
resources
:votes
root
to:
"pages#index"
root
to:
"pages#index"
get
'/pages/about'
,
to:
"pages#about"
get
'/votes/new'
,
to:
"votes#new"
get
'/party_lists/index'
,
to:
"party_lists#index"
get
'/votes/user_profile'
,
to:
"votes#profile"
get
'/votes/index'
,
to:
"votes#index"
post
'/checkout'
,
to:
'votes#checkout'
,
as: :checkout
end
Election/db/migrate/20160720111124_create_party_lists.rb
0 → 100644
View file @
2cc6b35b
class
CreatePartyLists
<
ActiveRecord
::
Migration
def
change
create_table
:party_lists
do
|
t
|
t
.
string
:name
t
.
timestamps
null:
false
end
end
end
Election/db/migrate/20160720112847_add_party_list_to_candidates.rb
0 → 100644
View file @
2cc6b35b
class
AddPartyListToCandidates
<
ActiveRecord
::
Migration
def
change
add_reference
:candidates
,
:party_list
,
index:
true
,
foreign_key:
true
end
end
Election/db/migrate/20160720124015_add_description_to_party_lists.rb
0 → 100644
View file @
2cc6b35b
class
AddDescriptionToPartyLists
<
ActiveRecord
::
Migration
def
change
add_column
:party_lists
,
:description_text
,
:string
remove_column
:party_lists
,
:description_text
,
:string
end
end
Election/db/migrate/20160720134047_add_description_to_party_lists.rb
0 → 100644
View file @
2cc6b35b
class
AddDescriptionToPartyLists
<
ActiveRecord
::
Migration
def
change
add_column
:party_lists
,
:description
,
:text
end
end
Election/db/schema.rb
View file @
2cc6b35b
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20160720
053151
)
do
ActiveRecord
::
Schema
.
define
(
version:
20160720
134047
)
do
create_table
"candidates"
,
force: :cascade
do
|
t
|
t
.
string
"first_name"
...
...
@@ -19,8 +19,19 @@ ActiveRecord::Schema.define(version: 20160720053151) do
t
.
string
"nickname"
t
.
text
"slogan"
t
.
integer
"position_id"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
integer
"party_list_id"
end
add_index
"candidates"
,
[
"party_list_id"
],
name:
"index_candidates_on_party_list_id"
create_table
"party_lists"
,
force: :cascade
do
|
t
|
t
.
string
"name"
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
string
"description_text"
t
.
text
"description"
end
create_table
"positions"
,
force: :cascade
do
|
t
|
...
...
Election/test/fixtures/party_lists.yml
0 → 100644
View file @
2cc6b35b
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one
:
name
:
MyString
two
:
name
:
MyString
Election/test/models/party_list_test.rb
0 → 100644
View file @
2cc6b35b
require
'test_helper'
class
PartyListTest
<
ActiveSupport
::
TestCase
# test "the truth" do
# assert true
# 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