Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
final_project
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
evilla_gomez_guian_principe
final_project
Commits
59a144cc
Commit
59a144cc
authored
Jul 21, 2016
by
April Guian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Individual Task Guian
parent
389ec497
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
23 deletions
+21
-23
election_controller.rb
Halalan-FINAL/app/controllers/election_controller.rb
+21
-23
No files found.
Halalan-FINAL/app/controllers/election_controller.rb
View file @
59a144cc
...
@@ -2,31 +2,29 @@ class ElectionController < ApplicationController
...
@@ -2,31 +2,29 @@ class ElectionController < ApplicationController
before_action
:authenticate_user!
before_action
:authenticate_user!
def
vote
def
vote
@positions
=
Position
.
all
@position
=
Position
.
find
(
params
[
:id
])
@candidates
=
Candidate
.
all
@candidates
=
Candidate
.
all
@positions
=
Position
.
all
@candidate
=
Candidate
.
find
(
params
[
:id
])
@user
=
User
.
find
(
params
[
:id
])
@user
=
User
.
find
(
params
[
:id
])
#@votes = Vote.all
#@position.candidates.each do |c|
@pos
=
params
[
:id
]
#Position.find(@pos).candidates.each do |c|
# c.votes.each do |v|
# c.votes.each do |v|
# if current_user.id == v.user_id
# if current_user.id == v.user_id
# voted_for = true
# voted_for = true
# end
# end
# end
# end
#
end
#
end
if
current_user
.
id
==
@user
if
current_user
.
id
==
@user
#if voted_for == false
redirect_to
new_voting_vote_path
(
@candidate
.
id
)
redirect_to
new_voting_vote_path
else
else
redirect_to
voting_votes_path
redirect_to
voting_votes_path
end
end
end
def
vote_params
params
.
require
(
:vote
).
permit!
end
end
end
end
\ No newline at end of file
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