Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
Final-Elections-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
Christiana Tan
Final-Elections-Project
Commits
eba37af2
Commit
eba37af2
authored
Jul 14, 2016
by
Christiana Tan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added some in models
parent
1571aa7f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
17 deletions
+23
-17
user.rb
app/models/user.rb
+8
-0
vote.rb
app/models/vote.rb
+4
-0
_form.html.erb
app/views/positions/_form.html.erb
+10
-0
new.html.erb
app/views/positions/new.html.erb
+1
-17
No files found.
app/models/user.rb
View file @
eba37af2
...
@@ -4,4 +4,12 @@ class User < ActiveRecord::Base
...
@@ -4,4 +4,12 @@ class User < ActiveRecord::Base
has_many
:votes
has_many
:votes
devise
:database_authenticatable
,
:registerable
,
devise
:database_authenticatable
,
:registerable
,
:recoverable
,
:rememberable
,
:trackable
,
:validatable
:recoverable
,
:rememberable
,
:trackable
,
:validatable
validates
:email
validates
:encrypted_password
,
presence:
true
validates
:first_name
,
presence:
true
validates
:last_name
,
presence:
true
validates
:birthday
validates
:gender
end
end
app/models/vote.rb
View file @
eba37af2
class
Vote
<
ActiveRecord
::
Base
class
Vote
<
ActiveRecord
::
Base
belongs_to
:user
belongs_to
:user
belongs_to
:candidate
belongs_to
:candidate
validates
:user_id
,
presence:
true
,
uniqueness:
true
validates
:candidate_id
,
presence:
true
,
uniqueness:
true
validates
:comments
end
end
app/views/positions/_form.html.erb
0 → 100644
View file @
eba37af2
<%=
simple_form_for
(
@position
)
do
|
p
|
%>
<%=
p
.
input
:name
%>
<%=
p
.
input
:number_of_winners
%>
<button
class =
"btn btn-success"
>
Create new position
<%
p
.
submit
%>
</button>
<%
end
%>
<%=
link_to
'Cancel'
,
positions_path
,
class:
"btn btn-danger"
%>
\ No newline at end of file
app/views/positions/new.html.erb
View file @
eba37af2
<h1>
New Position
</h1>
<h1>
New Position
</h1>
<%=
form_for
(
@position
)
do
|
p
|
%>
<%=
render
"form"
%>
<p>
<%=
p
.
label
"Name"
%>
<%=
p
.
text_field
:name
%>
</p>
<p>
<%=
p
.
label
"Number of Winners"
%>
<%=
p
.
text_field
:number_of_winners
%>
</p>
<button
class =
"btn btn-success"
>
Create new position
<%
p
.
submit
%>
</button>
<%
end
%>
<%=
link_to
'Cancel'
,
positions_path
,
class:
"btn btn-danger"
%>
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