Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: DesignWonk/Chad-V2
base: 34cfc4e5b7
...
head fork: DesignWonk/Chad-V2
compare: 296734aed3
  • 1 commit
  • 87 files changed
  • 0 commit comments
  • 1 contributor
Showing with 2,059 additions and 3 deletions.
  1. +1 −1  Gemfile
  2. +10 −0 Gemfile.lock
  3. +45 −0 Gemfile~
  4. +1 −0  Procfile
  5. +2 −0  app/controllers/application_controller.rb
  6. +3 −0  app/controllers/application_controller.rb~
  7. +83 −0 app/controllers/candidates_controller.rb
  8. +112 −0 app/controllers/voters_controller.rb
  9. +112 −0 app/controllers/voters_controller.rb~
  10. +83 −0 app/controllers/votes_controller.rb
  11. +2 −0  app/helpers/candidates_helper.rb
  12. +2 −0  app/helpers/voters_helper.rb
  13. +2 −0  app/helpers/votes_helper.rb
  14. +6 −0 app/models/candidate.rb
  15. +3 −0  app/models/candidate.rb~
  16. +10 −0 app/models/user.rb
  17. +10 −0 app/models/user.rb~
  18. +6 −0 app/models/vote.rb
  19. +3 −0  app/models/vote.rb~
  20. +11 −0 app/models/voter.rb
  21. +3 −0  app/models/voter.rb~
  22. +21 −0 app/views/candidates/_form.html.erb
  23. +6 −0 app/views/candidates/edit.html.erb
  24. +28 −0 app/views/candidates/index.html.erb
  25. +23 −0 app/views/candidates/index.html.erb~
  26. +5 −0 app/views/candidates/new.html.erb
  27. +10 −0 app/views/candidates/show.html.erb
  28. +12 −0 app/views/devise/confirmations/new.html.erb
  29. +5 −0 app/views/devise/mailer/confirmation_instructions.html.erb
  30. +8 −0 app/views/devise/mailer/reset_password_instructions.html.erb
  31. +7 −0 app/views/devise/mailer/unlock_instructions.html.erb
  32. +9 −0 app/views/devise/menu/_login_items.html.erb
  33. +9 −0 app/views/devise/menu/_registration_items.html.erb
  34. +16 −0 app/views/devise/passwords/edit.html.erb
  35. +12 −0 app/views/devise/passwords/new.html.erb
  36. +25 −0 app/views/devise/registrations/edit.html.erb
  37. +18 −0 app/views/devise/registrations/new.html.erb
  38. +17 −0 app/views/devise/sessions/new.html.erb
  39. +25 −0 app/views/devise/shared/_links.erb
  40. +12 −0 app/views/devise/unlocks/new.html.erb
  41. +5 −0 app/views/layouts/application.html.erb
  42. +19 −0 app/views/layouts/application.html.erb~
  43. +35 −0 app/views/voters/_form.html.erb
  44. +21 −0 app/views/voters/_form.html.erb~
  45. +27 −0 app/views/voters/admin.html.erb
  46. +6 −0 app/views/voters/edit.html.erb
  47. +37 −0 app/views/voters/index.html.erb
  48. +37 −0 app/views/voters/index.html.erb~
  49. +5 −0 app/views/voters/new.html.erb
  50. +24 −0 app/views/voters/show.html.erb
  51. +10 −0 app/views/voters/show.html.erb~
  52. +21 −0 app/views/votes/_form.html.erb
  53. +6 −0 app/views/votes/edit.html.erb
  54. +23 −0 app/views/votes/index.html.erb
  55. +5 −0 app/views/votes/new.html.erb
  56. +10 −0 app/views/votes/show.html.erb
  57. +6 −0 config/environments/development.rb
  58. +37 −0 config/environments/development.rb~
  59. +218 −0 config/initializers/devise.rb
  60. +218 −0 config/initializers/devise.rb~
  61. +57 −0 config/locales/devise.en.yml
  62. +6 −2 config/routes.rb
  63. +61 −0 config/routes.rb~
  64. +46 −0 db/migrate/20120628205255_devise_create_users.rb
  65. +5 −0 db/migrate/20120628205442_add_username_to_users.rb
  66. +9 −0 db/migrate/20120628210643_create_candidates.rb
  67. +8 −0 db/migrate/20120628210643_create_candidates.rb~
  68. +9 −0 db/migrate/20120628210650_create_votes.rb
  69. +8 −0 db/migrate/20120628210650_create_votes.rb~
  70. +9 −0 db/migrate/20120628210838_create_voters.rb
  71. +8 −0 db/migrate/20120628210838_create_voters.rb~
  72. +54 −0 db/schema.rb
  73. BIN  public/.DS_Store
  74. +11 −0 test/fixtures/candidates.yml
  75. +11 −0 test/fixtures/users.yml
  76. +11 −0 test/fixtures/voters.yml
  77. +11 −0 test/fixtures/votes.yml
  78. +49 −0 test/functional/candidates_controller_test.rb
  79. +49 −0 test/functional/voters_controller_test.rb
  80. +49 −0 test/functional/votes_controller_test.rb
  81. +7 −0 test/unit/candidate_test.rb
  82. +4 −0 test/unit/helpers/candidates_helper_test.rb
  83. +4 −0 test/unit/helpers/voters_helper_test.rb
  84. +4 −0 test/unit/helpers/votes_helper_test.rb
  85. +7 −0 test/unit/user_test.rb
  86. +7 −0 test/unit/vote_test.rb
  87. +7 −0 test/unit/voter_test.rb
View
2  Gemfile
@@ -1,13 +1,13 @@
source 'https://rubygems.org'
gem 'rails', '3.2.3'
+gem 'devise'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
-
# Gems used only for assets and not required
# in production environments by default.
group :assets do
View
10 Gemfile.lock
@@ -29,6 +29,7 @@ GEM
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
+ bcrypt-ruby (3.0.1)
builder (3.0.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@@ -37,6 +38,11 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.3.3)
+ devise (2.1.0)
+ bcrypt-ruby (~> 3.0)
+ orm_adapter (~> 0.0.7)
+ railties (~> 3.1)
+ warden (~> 1.1.1)
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
@@ -53,6 +59,7 @@ GEM
treetop (~> 1.4.8)
mime-types (1.19)
multi_json (1.3.6)
+ orm_adapter (0.0.7)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
@@ -98,12 +105,15 @@ GEM
uglifier (1.2.5)
execjs (>= 0.3.0)
multi_json (~> 1.3)
+ warden (1.1.1)
+ rack (>= 1.0)
PLATFORMS
ruby
DEPENDENCIES
coffee-rails (~> 3.2.1)
+ devise
jquery-rails
rails (= 3.2.3)
sass-rails (~> 3.2.3)
View
45 Gemfile~
@@ -0,0 +1,45 @@
+source 'https://rubygems.org'
+
+gem 'rails', '3.2.3'
+gem 'devise'
+gem 'thin'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+group :development, :test do
+ gem ‘sqlite3’
+end
+
+group :production do
+ gem ‘pg’
+end
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.2.3'
+ gem 'coffee-rails', '~> 3.2.1'
+
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+ # gem 'therubyracer', :platform => :ruby
+
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
+# To use ActiveModel has_secure_password
+# gem 'bcrypt-ruby', '~> 3.0.0'
+
+# To use Jbuilder templates for JSON
+# gem 'jbuilder'
+
+# Use unicorn as the app server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+# gem 'capistrano'
+
+# To use debugger
+# gem 'ruby-debug19', :require => 'ruby-debug'
View
1  Procfile
@@ -0,0 +1 @@
+web: bundle exec thin start –p $PORT
View
2  app/controllers/application_controller.rb
@@ -1,3 +1,5 @@
class ApplicationController < ActionController::Base
+ before_filter :authenticate_user!
+
protect_from_forgery
end
View
3  app/controllers/application_controller.rb~
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
View
83 app/controllers/candidates_controller.rb
@@ -0,0 +1,83 @@
+class CandidatesController < ApplicationController
+ # GET /candidates
+ # GET /candidates.json
+ def index
+ @candidates = Candidate.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @candidates }
+ end
+ end
+
+ # GET /candidates/1
+ # GET /candidates/1.json
+ def show
+ @candidate = Candidate.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @candidate }
+ end
+ end
+
+ # GET /candidates/new
+ # GET /candidates/new.json
+ def new
+ @candidate = Candidate.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @candidate }
+ end
+ end
+
+ # GET /candidates/1/edit
+ def edit
+ @candidate = Candidate.find(params[:id])
+ end
+
+ # POST /candidates
+ # POST /candidates.json
+ def create
+ @candidate = Candidate.new(params[:candidate])
+
+ respond_to do |format|
+ if @candidate.save
+ format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }
+ format.json { render json: @candidate, status: :created, location: @candidate }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @candidate.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /candidates/1
+ # PUT /candidates/1.json
+ def update
+ @candidate = Candidate.find(params[:id])
+
+ respond_to do |format|
+ if @candidate.update_attributes(params[:candidate])
+ format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @candidate.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /candidates/1
+ # DELETE /candidates/1.json
+ def destroy
+ @candidate = Candidate.find(params[:id])
+ @candidate.destroy
+
+ respond_to do |format|
+ format.html { redirect_to candidates_url }
+ format.json { head :no_content }
+ end
+ end
+end
View
112 app/controllers/voters_controller.rb
@@ -0,0 +1,112 @@
+class VotersController < ApplicationController
+
+ before_filter :authenticate_voter!, :except => [:index]
+
+ # GET /voters
+ # GET /voters.json
+ def index
+ @voters = Voter.all
+
+ @votes = Vote.all
+ @candidates = Candidate.all
+
+ #votecount = Vote.all.map {|vote| vote.candidate_id}
+ #freq = votecount.inject(Hash.new(0)) { |h,v| h[v] += 1; h}
+ #@winner = (votecount.sort_by { |v| freq[v]}.last).name
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @voters }
+ end
+ end
+
+ # GET /voters/1
+ # GET /voters/1.json
+ def show
+ @voter = Voter.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @voter }
+ end
+ end
+
+ # GET /voters/new
+ # GET /voters/new.json
+ def new
+ @voter = Voter.new
+
+ @candidates = Candidate.all
+
+ @voter.build_vote
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @voter }
+ end
+ end
+
+ # GET /voters/1/edit
+ def edit
+ @voter = Voter.find(params[:id])
+
+ @candidates = Candidate.all
+ end
+
+ # POST /voters
+ # POST /voters.json
+ def create
+ @voter = Voter.new(params[:voter])
+
+ respond_to do |format|
+ if @voter.save
+ format.html { redirect_to @voter, notice: 'Voter was successfully created.' }
+ format.json { render json: @voter, status: :created, location: @voter }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @voter.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /voters/1
+ # PUT /voters/1.json
+ def update
+ @voter = Voter.find(params[:id])
+
+ respond_to do |format|
+ if @voter.update_attributes(params[:voter])
+ format.html { redirect_to @voter, notice: 'Voter was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @voter.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /voters/1
+ # DELETE /voters/1.json
+ def destroy
+ @voter = Voter.find(params[:id])
+ @voter.destroy
+
+ respond_to do |format|
+ format.html { redirect_to voters_url }
+ format.json { head :no_content }
+ end
+ end
+
+ # ADMIN
+ def admin
+ @voters = Voter.all
+ @votes = Vote.all
+ @candidates = Candidate.all
+
+ respond_to do |format|
+ format.html
+ format.json { render json: @voters }
+ end
+ end
+
+end
View
112 app/controllers/voters_controller.rb~
@@ -0,0 +1,112 @@
+class VotersController < ApplicationController
+
+ before_filter :authenticate_voter!, :except => [:index]
+
+ # GET /voters
+ # GET /voters.json
+ def index
+ @voters = Voter.all
+
+ @votes = Vote.all
+ @candidates = Candidate.all
+
+ votecount = Vote.all.map {|vote| vote.candidate_id}
+ freq = votecount.inject(Hash.new(0)) { |h,v| h[v] += 1; h}
+ @winner = (votecount.sort_by { |v| freq[v]}.last).name
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @voters }
+ end
+ end
+
+ # GET /voters/1
+ # GET /voters/1.json
+ def show
+ @voter = Voter.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @voter }
+ end
+ end
+
+ # GET /voters/new
+ # GET /voters/new.json
+ def new
+ @voter = Voter.new
+
+ @candidates = Candidate.all
+
+ @voter.build_vote
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @voter }
+ end
+ end
+
+ # GET /voters/1/edit
+ def edit
+ @voter = Voter.find(params[:id])
+
+ @candidates = Candidate.all
+ end
+
+ # POST /voters
+ # POST /voters.json
+ def create
+ @voter = Voter.new(params[:voter])
+
+ respond_to do |format|
+ if @voter.save
+ format.html { redirect_to @voter, notice: 'Voter was successfully created.' }
+ format.json { render json: @voter, status: :created, location: @voter }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @voter.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /voters/1
+ # PUT /voters/1.json
+ def update
+ @voter = Voter.find(params[:id])
+
+ respond_to do |format|
+ if @voter.update_attributes(params[:voter])
+ format.html { redirect_to @voter, notice: 'Voter was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @voter.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /voters/1
+ # DELETE /voters/1.json
+ def destroy
+ @voter = Voter.find(params[:id])
+ @voter.destroy
+
+ respond_to do |format|
+ format.html { redirect_to voters_url }
+ format.json { head :no_content }
+ end
+ end
+
+ # ADMIN
+ def admin
+ @voters = Voter.all
+ @votes = Vote.all
+ @candidates = Candidate.all
+
+ respond_to do |format|
+ format.html
+ format.json { render json: @voters }
+ end
+ end
+
+end
View
83 app/controllers/votes_controller.rb
@@ -0,0 +1,83 @@
+class VotesController < ApplicationController
+ # GET /votes
+ # GET /votes.json
+ def index
+ @votes = Vote.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @votes }
+ end
+ end
+
+ # GET /votes/1
+ # GET /votes/1.json
+ def show
+ @vote = Vote.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @vote }
+ end
+ end
+
+ # GET /votes/new
+ # GET /votes/new.json
+ def new
+ @vote = Vote.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @vote }
+ end
+ end
+
+ # GET /votes/1/edit
+ def edit
+ @vote = Vote.find(params[:id])
+ end
+
+ # POST /votes
+ # POST /votes.json
+ def create
+ @vote = Vote.new(params[:vote])
+
+ respond_to do |format|
+ if @vote.save
+ format.html { redirect_to @vote, notice: 'Vote was successfully created.' }
+ format.json { render json: @vote, status: :created, location: @vote }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @vote.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /votes/1
+ # PUT /votes/1.json
+ def update
+ @vote = Vote.find(params[:id])
+
+ respond_to do |format|
+ if @vote.update_attributes(params[:vote])
+ format.html { redirect_to @vote, notice: 'Vote was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @vote.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /votes/1
+ # DELETE /votes/1.json
+ def destroy
+ @vote = Vote.find(params[:id])
+ @vote.destroy
+
+ respond_to do |format|
+ format.html { redirect_to votes_url }
+ format.json { head :no_content }
+ end
+ end
+end
View
2  app/helpers/candidates_helper.rb
@@ -0,0 +1,2 @@
+module CandidatesHelper
+end
View
2  app/helpers/voters_helper.rb
@@ -0,0 +1,2 @@
+module VotersHelper
+end
View
2  app/helpers/votes_helper.rb
@@ -0,0 +1,2 @@
+module VotesHelper
+end
View
6 app/models/candidate.rb
@@ -0,0 +1,6 @@
+class Candidate < ActiveRecord::Base
+ attr_accessible :name
+
+ has_many :votes
+ has_many :voters, :through => :vote
+end
View
3  app/models/candidate.rb~
@@ -0,0 +1,3 @@
+class Candidate < ActiveRecord::Base
+ # attr_accessible :title, :body
+end
View
10 app/models/user.rb
@@ -0,0 +1,10 @@
+class User < ActiveRecord::Base
+ # Include default devise modules. Others available are:
+ # :token_authenticatable, :confirmable,
+ # :lockable, :timeoutable and :omniauthable
+ devise :database_authenticatable, :registerable,
+ :recoverable, :rememberable, :trackable, :validatable
+
+ # Setup accessible (or protected) attributes for your model
+ attr_accessible :username, :email, :password, :password_confirmation, :remember_me
+end
View
10 app/models/user.rb~
@@ -0,0 +1,10 @@
+class User < ActiveRecord::Base
+ # Include default devise modules. Others available are:
+ # :token_authenticatable, :confirmable,
+ # :lockable, :timeoutable and :omniauthable
+ devise :database_authenticatable, :registerable,
+ :recoverable, :rememberable, :trackable, :validatable
+
+ # Setup accessible (or protected) attributes for your model
+ attr_accessible :username, :email, :password, :password_confirmation, :remember_me, :login
+end
View
6 app/models/vote.rb
@@ -0,0 +1,6 @@
+class Vote < ActiveRecord::Base
+ attr_accessible :voter_id, :candidate_id
+
+ belongs_to :voter
+ belongs_to :candidate
+end
View
3  app/models/vote.rb~
@@ -0,0 +1,3 @@
+class Vote < ActiveRecord::Base
+ # attr_accessible :title, :body
+end
View
11 app/models/voter.rb
@@ -0,0 +1,11 @@
+class Voter < ActiveRecord::Base
+ attr_accessible :name,
+ :id,
+ :vote_attributes,
+ :candidate_attributes
+
+ has_one :vote, :dependent => :destroy
+ has_one :candidate, :through => :vote
+
+ accepts_nested_attributes_for :vote
+end
View
3  app/models/voter.rb~
@@ -0,0 +1,3 @@
+class Voter < ActiveRecord::Base
+ # attr_accessible :title, :body
+end
View
21 app/views/candidates/_form.html.erb
@@ -0,0 +1,21 @@
+<%= form_for(@candidate) do |f| %>
+ <% if @candidate.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@candidate.errors.count, "error") %> prohibited this candidate from being saved:</h2>
+
+ <ul>
+ <% @candidate.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :name %><br />
+ <%= f.text_field :name %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
View
6 app/views/candidates/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing candidate</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @candidate %> |
+<%= link_to 'Back', candidates_path %>
View
28 app/views/candidates/index.html.erb
@@ -0,0 +1,28 @@
+<h1>Listing candidates</h1>
+
+<table>
+ <tr>
+ <th align="left">Name</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @candidates.each do |candidate| %>
+ <tr>
+ <td><%= candidate.name %></td>
+ <td><%= link_to 'Show', candidate %></td>
+ <td><%= link_to 'Edit', edit_candidate_path(candidate) %></td>
+ <td><%= link_to 'Destroy', candidate, confirm: 'Are you sure?', method: :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New Candidate', new_candidate_path %>
+
+<br />
+<br />
+
+<%= link_to 'Voters Page', voters_path %>
View
23 app/views/candidates/index.html.erb~
@@ -0,0 +1,23 @@
+<h1>Listing candidates</h1>
+
+<table>
+ <tr>
+ <th>Name</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @candidates.each do |candidate| %>
+ <tr>
+ <td><%= candidate.name %></td>
+ <td><%= link_to 'Show', candidate %></td>
+ <td><%= link_to 'Edit', edit_candidate_path(candidate) %></td>
+ <td><%= link_to 'Destroy', candidate, confirm: 'Are you sure?', method: :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New Candidate', new_candidate_path %>
View
5 app/views/candidates/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New candidate</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', candidates_path %>
View
10 app/views/candidates/show.html.erb
@@ -0,0 +1,10 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>Name:</b>
+ <%= @candidate.name %>
+</p>
+
+
+<%= link_to 'Edit', edit_candidate_path(@candidate) %> |
+<%= link_to 'Back', candidates_path %>
View
12 app/views/devise/confirmations/new.html.erb
@@ -0,0 +1,12 @@
+<h2>Resend confirmation instructions</h2>
+
+<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <div><%= f.label :email %><br />
+ <%= f.email_field :email %></div>
+
+ <div><%= f.submit "Resend confirmation instructions" %></div>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
View
5 app/views/devise/mailer/confirmation_instructions.html.erb
@@ -0,0 +1,5 @@
+<p>Welcome <%= @resource.email %>!</p>
+
+<p>You can confirm your account email through the link below:</p>
+
+<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
View
8 app/views/devise/mailer/reset_password_instructions.html.erb
@@ -0,0 +1,8 @@
+<p>Hello <%= @resource.email %>!</p>
+
+<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
+
+<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
+
+<p>If you didn't request this, please ignore this email.</p>
+<p>Your password won't change until you access the link above and create a new one.</p>
View
7 app/views/devise/mailer/unlock_instructions.html.erb
@@ -0,0 +1,7 @@
+<p>Hello <%= @resource.email %>!</p>
+
+<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
+
+<p>Click the link below to unlock your account:</p>
+
+<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
View
9 app/views/devise/menu/_login_items.html.erb
@@ -0,0 +1,9 @@
+<% if user_signed_in? %>
+ <li>
+ <%= link_to('Logout', destroy_user_session_path, :method => :delete) %>
+ </li>
+<% else %>
+ <li>
+ <%= link_to('Login', new_user_session_path) %>
+ </li>
+<% end %>
View
9 app/views/devise/menu/_registration_items.html.erb
@@ -0,0 +1,9 @@
+<% if user_signed_in? %>
+ <li>
+ <%= link_to('Edit registration', edit_user_registration_path) %>
+ </li>
+<% else %>
+ <li>
+ <%= link_to('Register', new_user_registration_path) %>
+ </li>
+<% end %>
View
16 app/views/devise/passwords/edit.html.erb
@@ -0,0 +1,16 @@
+<h2>Change your password</h2>
+
+<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
+ <%= devise_error_messages! %>
+ <%= f.hidden_field :reset_password_token %>
+
+ <div><%= f.label :password, "New password" %><br />
+ <%= f.password_field :password %></div>
+
+ <div><%= f.label :password_confirmation, "Confirm new password" %><br />
+ <%= f.password_field :password_confirmation %></div>
+
+ <div><%= f.submit "Change my password" %></div>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
View
12 app/views/devise/passwords/new.html.erb
@@ -0,0 +1,12 @@
+<h2>Forgot your password?</h2>
+
+<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <div><%= f.label :email %><br />
+ <%= f.email_field :email %></div>
+
+ <div><%= f.submit "Send me reset password instructions" %></div>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
View
25 app/views/devise/registrations/edit.html.erb
@@ -0,0 +1,25 @@
+<h2>Edit <%= resource_name.to_s.humanize %></h2>
+
+<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <div><%= f.label :email %><br />
+ <%= f.email_field :email %></div>
+
+ <div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
+ <%= f.password_field :password, :autocomplete => "off" %></div>
+
+ <div><%= f.label :password_confirmation %><br />
+ <%= f.password_field :password_confirmation %></div>
+
+ <div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
+ <%= f.password_field :current_password %></div>
+
+ <div><%= f.submit "Update" %></div>
+<% end %>
+
+<h3>Cancel my account</h3>
+
+<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
+
+<%= link_to "Back", :back %>
View
18 app/views/devise/registrations/new.html.erb
@@ -0,0 +1,18 @@
+<h2>Sign up</h2>
+
+<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
+ <%= devise_error_messages! %>
+
+ <div><%= f.label :email %><br />
+ <%= f.email_field :email %></div>
+
+ <div><%= f.label :password %><br />
+ <%= f.password_field :password %></div>
+
+ <div><%= f.label :password_confirmation %><br />
+ <%= f.password_field :password_confirmation %></div>
+
+ <div><%= f.submit "Sign up" %></div>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
View
17 app/views/devise/sessions/new.html.erb
@@ -0,0 +1,17 @@
+<h2>Sign in</h2>
+
+<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
+ <div><%= f.label :email %><br />
+ <%= f.email_field :email %></div>
+
+ <div><%= f.label :password %><br />
+ <%= f.password_field :password %></div>
+
+ <% if devise_mapping.rememberable? -%>
+ <div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
+ <% end -%>
+
+ <div><%= f.submit "Sign in" %></div>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
View
25 app/views/devise/shared/_links.erb
@@ -0,0 +1,25 @@
+<%- if controller_name != 'sessions' %>
+ <%= link_to "Sign in", new_session_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
+ <%= link_to "Sign up", new_registration_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
+ <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.omniauthable? %>
+ <%- resource_class.omniauth_providers.each do |provider| %>
+ <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
+ <% end -%>
+<% end -%>
View
12 app/views/devise/unlocks/new.html.erb
@@ -0,0 +1,12 @@
+<h2>Resend unlock instructions</h2>
+
+<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <div><%= f.label :email %><br />
+ <%= f.email_field :email %></div>
+
+ <div><%= f.submit "Resend unlock instructions" %></div>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
View
5 app/views/layouts/application.html.erb
@@ -8,6 +8,11 @@
</head>
<body>
+<ul class="hmenu">
+ <%= render 'devise/menu/registration_items' %>
+ <%= render 'devise/menu/login_items' %>
+</ul>
+
<%= yield %>
</body>
View
19 app/views/layouts/application.html.erb~
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>ChadV2</title>
+ <%= stylesheet_link_tag "application", :media => "all" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
+</head>
+<body>
+
+<ul class="hmenu">
+ <%= render 'devise/menu/registration_items' %>
+ <%= render 'devise/menu/login_items' %>
+</ul>
+
+<%= yield %>
+
+</body>
+</html>
View
35 app/views/voters/_form.html.erb
@@ -0,0 +1,35 @@
+<%= form_for(@voter) do |f| %>
+ <% if @voter.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@voter.errors.count, "error") %> prohibited this voter from being saved:</h2>
+
+ <ul>
+ <% @voter.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.fields_for :vote do |vote| %>
+
+ <% @candidates.each do | candidate | %>
+
+ <%= vote.radio_button :candidate_id , candidate.id %>
+ <%= vote.label :candidate_id, candidate.name %>
+ <br>
+
+ <% end %>
+
+ <% end %>
+ </div>
+
+ <div class="field">
+ <%= f.label :name %><br />
+ <%= f.text_field :name %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
View
21 app/views/voters/_form.html.erb~
@@ -0,0 +1,21 @@
+<%= form_for(@voter) do |f| %>
+ <% if @voter.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@voter.errors.count, "error") %> prohibited this voter from being saved:</h2>
+
+ <ul>
+ <% @voter.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :name %><br />
+ <%= f.text_field :name %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
View
27 app/views/voters/admin.html.erb
@@ -0,0 +1,27 @@
+<h1>Administrator</h1>
+
+<table>
+ <tr>
+ <th align="left">Voter</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @voters.each do |voter| %>
+ <tr>
+ <td><%= voter.name %></td>
+ <td><%= link_to 'Show', voter %></td>
+ <td><%= link_to 'Edit', edit_voter_path(voter) %></td>
+ <td><%= link_to 'Destroy', voter, confirm: 'Are you sure?', method: :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'Candidates Page', candidates_path %>
+
+<!-- br / -->
+
+<!-- %= link_to 'New Voter', new_voter_path % -->
View
6 app/views/voters/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing voter</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @voter %> |
+<%= link_to 'Back', voters_path %>
View
37 app/views/voters/index.html.erb
@@ -0,0 +1,37 @@
+<h1>Stats</h1>
+
+<table>
+
+<% totalvotes = @votes.count %>
+
+ <tr>
+ <th align="left">Candidate</th>
+ <th align="right">Votes</th>
+ <th align="right">Percent</th>
+ </tr>
+
+ <% @candidates.each do |candidate| %>
+ <% votecount = @votes.count {|vote| vote.candidate_id == candidate.id } %>
+
+ <tr>
+ <td><%= candidate.name %></td>
+ <td align="right"><%= votecount %></td>
+ <td align="right"><%= 100 * votecount/totalvotes %>%</td>
+ </tr>
+
+<% end %>
+
+</table>
+</p>
+
+<br />
+
+<p>
+<%= @winner %> wins!
+</p>
+
+<!-- %= link_to "Create Account", new_voter_registration_path % -->
+
+<br />
+
+
View
37 app/views/voters/index.html.erb~
@@ -0,0 +1,37 @@
+<h1>Stats</h1>
+
+<table>
+
+<% totalvotes = @votes.count %>
+
+ <tr>
+ <th align="left">Candidate</th>
+ <th align="right">Votes</th>
+ <th align="right">Percent</th>
+ </tr>
+
+ <% @candidates.each do |candidate| %>
+ <% votecount = @votes.count {|vote| vote.candidate_id == candidate.id } %>
+
+ <tr>
+ <td><%= candidate.name %></td>
+ <td align="right"><%= votecount %></td>
+ <td align="right"><%= 100 * votecount/totalvotes %>%</td>
+ </tr>
+
+<% end %>
+
+</table>
+</p>
+
+<br />
+
+<p>
+<%= @winner %> wins!
+</p>
+
+<%= link_to "Create Account", new_voter_registration_path %>
+
+<br />
+
+
View
5 app/views/voters/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New voter</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', voters_path %>
View
24 app/views/voters/show.html.erb
@@ -0,0 +1,24 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>Name:</b>
+ <%= @voter.name %>
+</p>
+
+
+<p>
+
+ <b>Vote</b><br>
+
+ <table>
+ <tr><td>Candidate ID: </td><td><%= @voter.vote.candidate_id %></td></tr>
+
+ <tr><td>Candidate Name: </td><td><%= @voter.vote.candidate.name %></td></tr>
+
+ <tr><td>Vote time: </td><td><%= @voter.vote.updated_at.asctime %></td></tr>
+ </table>
+
+</p>
+
+<%= link_to 'Edit', edit_voter_path(@voter) %> |
+<%= link_to 'Back', voters_path %>
View
10 app/views/voters/show.html.erb~
@@ -0,0 +1,10 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>Name:</b>
+ <%= @voter.name %>
+</p>
+
+
+<%= link_to 'Edit', edit_voter_path(@voter) %> |
+<%= link_to 'Back', voters_path %>
View
21 app/views/votes/_form.html.erb
@@ -0,0 +1,21 @@
+<%= form_for(@vote) do |f| %>
+ <% if @vote.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@vote.errors.count, "error") %> prohibited this vote from being saved:</h2>
+
+ <ul>
+ <% @vote.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :name %><br />
+ <%= f.text_field :name %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
View
6 app/views/votes/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing vote</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @vote %> |
+<%= link_to 'Back', votes_path %>
View
23 app/views/votes/index.html.erb
@@ -0,0 +1,23 @@
+<h1>Listing votes</h1>
+
+<table>
+ <tr>
+ <th>Name</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @votes.each do |vote| %>
+ <tr>
+ <td><%= vote.name %></td>
+ <td><%= link_to 'Show', vote %></td>
+ <td><%= link_to 'Edit', edit_vote_path(vote) %></td>
+ <td><%= link_to 'Destroy', vote, confirm: 'Are you sure?', method: :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New Vote', new_vote_path %>
View
5 app/views/votes/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New vote</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', votes_path %>
View
10 app/views/votes/show.html.erb
@@ -0,0 +1,10 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>Name:</b>
+ <%= @vote.name %>
+</p>
+
+
+<%= link_to 'Edit', edit_vote_path(@vote) %> |
+<%= link_to 'Back', votes_path %>
View
6 config/environments/development.rb
@@ -8,6 +8,12 @@
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
+
+ # Devise
+ config.action_mailer.default_url_options = { :host => 'localhost:3000' }
+
+ # Devise Heroku
+ #config.assets.initialize_on_precompile = false
# Show full error reports and disable caching
config.consider_all_requests_local = true
View
37 config/environments/development.rb~
@@ -0,0 +1,37 @@
+ChadV2::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.cache_classes = false
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger
+ config.active_support.deprecation = :log
+
+ # Only use best-standards-support built into browsers
+ config.action_dispatch.best_standards_support = :builtin
+
+ # Raise exception on mass assignment protection for Active Record models
+ config.active_record.mass_assignment_sanitizer = :strict
+
+ # Log the query plan for queries taking more than this (works
+ # with SQLite, MySQL, and PostgreSQL)
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
+
+ # Do not compress assets
+ config.assets.compress = false
+
+ # Expands the lines which load the assets
+ config.assets.debug = true
+end
View
218 config/initializers/devise.rb
@@ -0,0 +1,218 @@
+# Use this hook to configure devise mailer, warden hooks and so forth.
+# Many of these configuration options can be set straight in your model.
+Devise.setup do |config|
+ config.sign_out_via = :get
+
+ # ==> Mailer Configuration
+ # Configure the e-mail address which will be shown in Devise::Mailer,
+ # note that it will be overwritten if you use your own mailer class with default "from" parameter.
+ config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
+
+ # Configure the class responsible to send e-mails.
+ # config.mailer = "Devise::Mailer"
+
+ # ==> ORM configuration
+ # Load and configure the ORM. Supports :active_record (default) and
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
+ # available as additional gems.
+ require 'devise/orm/active_record'
+
+ # ==> Configuration for any authentication mechanism
+ # Configure which keys are used when authenticating a user. The default is
+ # just :email. You can configure it to use [:username, :subdomain], so for
+ # authenticating a user, both parameters are required. Remember that those
+ # parameters are used only when authenticating and not when retrieving from
+ # session. If you need permissions, you should implement that in a before filter.
+ # You can also supply a hash where the value is a boolean determining whether
+ # or not authentication should be aborted when the value is not present.
+ config.authentication_keys = [ :email ]
+
+ # Configure parameters from the request object used for authentication. Each entry
+ # given should be a request method and it will automatically be passed to the
+ # find_for_authentication method and considered in your model lookup. For instance,
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
+ # config.request_keys = []
+
+ # Configure which authentication keys should be case-insensitive.
+ # These keys will be downcased upon creating or modifying a user and when used
+ # to authenticate or find a user. Default is :email.
+ config.case_insensitive_keys = [ :email ]
+
+ # Configure which authentication keys should have whitespace stripped.
+ # These keys will have whitespace before and after removed upon creating or
+ # modifying a user and when used to authenticate or find a user. Default is :email.
+ config.strip_whitespace_keys = [ :email ]
+
+ # Tell if authentication through request.params is enabled. True by default.
+ # It can be set to an array that will enable params authentication only for the
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
+ # enable it only for database (email + password) authentication.
+ # config.params_authenticatable = true
+
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
+ # It can be set to an array that will enable http authentication only for the
+ # given strategies, for example, `config.http_authenticatable = [:token]` will
+ # enable it only for token authentication.
+ # config.http_authenticatable = false
+
+ # If http headers should be returned for AJAX requests. True by default.
+ # config.http_authenticatable_on_xhr = true
+
+ # The realm used in Http Basic Authentication. "Application" by default.
+ # config.http_authentication_realm = "Application"
+
+ # It will change confirmation, password recovery and other workflows
+ # to behave the same regardless if the e-mail provided was right or wrong.
+ # Does not affect registerable.
+ # config.paranoid = true
+
+ # By default Devise will store the user in session. You can skip storage for
+ # :http_auth and :token_auth by adding those symbols to the array below.
+ # Notice that if you are skipping storage for all authentication paths, you
+ # may want to disable generating routes to Devise's sessions controller by
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
+ config.skip_session_storage = [:http_auth]
+
+ # ==> Configuration for :database_authenticatable
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
+ # using other encryptors, it sets how many times you want the password re-encrypted.
+ #
+ # Limiting the stretches to just one in testing will increase the performance of
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
+ # a value less than 10 in other environments.
+ config.stretches = Rails.env.test? ? 1 : 10
+
+ # Setup a pepper to generate the encrypted password.
+ # config.pepper = "34fe9dcafbfe00e16095f63f68048770e1199ac561be20d9c30ecc832858c77107fcdadde2af2ba2382d2d03e584a02d2b6ea68a4b39fd8d383795a634c3b83f"
+
+ # ==> Configuration for :confirmable
+ # A period that the user is allowed to access the website even without
+ # confirming his account. For instance, if set to 2.days, the user will be
+ # able to access the website for two days without confirming his account,
+ # access will be blocked just in the third day. Default is 0.days, meaning
+ # the user cannot access the website without confirming his account.
+ # config.allow_unconfirmed_access_for = 2.days
+
+ # If true, requires any email changes to be confirmed (exactly the same way as
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
+ # db field (see migrations). Until confirmed new email is stored in
+ # unconfirmed email column, and copied to email column on successful confirmation.
+ config.reconfirmable = true
+
+ # Defines which key will be used when confirming an account
+ # config.confirmation_keys = [ :email ]
+
+ # ==> Configuration for :rememberable
+ # The time the user will be remembered without asking for credentials again.
+ # config.remember_for = 2.weeks
+
+ # If true, extends the user's remember period when remembered via cookie.
+ # config.extend_remember_period = false
+
+ # Options to be passed to the created cookie. For instance, you can set
+ # :secure => true in order to force SSL only cookies.
+ # config.rememberable_options = {}
+
+ # ==> Configuration for :validatable
+ # Range for password length. Default is 6..128.
+ # config.password_length = 6..128
+
+ # Email regex used to validate email formats. It simply asserts that
+ # an one (and only one) @ exists in the given string. This is mainly
+ # to give user feedback and not to assert the e-mail validity.
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
+
+ # ==> Configuration for :timeoutable
+ # The time you want to timeout the user session without activity. After this
+ # time the user will be asked for credentials again. Default is 30 minutes.
+ # config.timeout_in = 30.minutes
+
+ # ==> Configuration for :lockable
+ # Defines which strategy will be used to lock an account.
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
+ # :none = No lock strategy. You should handle locking by yourself.
+ # config.lock_strategy = :failed_attempts
+
+ # Defines which key will be used when locking and unlocking an account
+ # config.unlock_keys = [ :email ]
+
+ # Defines which strategy will be used to unlock an account.
+ # :email = Sends an unlock link to the user email
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
+ # :both = Enables both strategies
+ # :none = No unlock strategy. You should handle unlocking by yourself.
+ # config.unlock_strategy = :both
+
+ # Number of authentication tries before locking an account if lock_strategy
+ # is failed attempts.
+ # config.maximum_attempts = 20
+
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
+ # config.unlock_in = 1.hour
+
+ # ==> Configuration for :recoverable
+ #
+ # Defines which key will be used when recovering the password for an account
+ # config.reset_password_keys = [ :email ]
+
+ # Time interval you can reset your password with a reset password key.
+ # Don't put a too small interval or your users won't have the time to
+ # change their passwords.
+ config.reset_password_within = 6.hours
+
+ # ==> Configuration for :encryptable
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
+ # REST_AUTH_SITE_KEY to pepper)
+ # config.encryptor = :sha512
+
+ # ==> Configuration for :token_authenticatable
+ # Defines name of the authentication token params key
+ # config.token_authentication_key = :auth_token
+
+ # ==> Scopes configuration
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
+ # "users/sessions/new". It's turned off by default because it's slower if you
+ # are using only default views.
+ # config.scoped_views = false
+
+ # Configure the default scope given to Warden. By default it's the first
+ # devise role declared in your routes (usually :user).
+ # config.default_scope = :user
+
+ # Configure sign_out behavior.
+ # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
+ # The default is true, which means any logout action will sign out all active scopes.
+ # config.sign_out_all_scopes = true
+
+ # ==> Navigation configuration
+ # Lists the formats that should be treated as navigational. Formats like
+ # :html, should redirect to the sign in page when the user does not have
+ # access, but formats like :xml or :json, should return 401.
+ #
+ # If you have any extra navigational formats, like :iphone or :mobile, you
+ # should add them to the navigational formats lists.
+ #
+ # The "*/*" below is required to match Internet Explorer requests.
+ # config.navigational_formats = ["*/*", :html]
+
+ # The default HTTP method used to sign out a resource. Default is :delete.
+ config.sign_out_via = :delete
+
+ # ==> OmniAuth
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
+ # up on your models and hooks.
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
+
+ # ==> Warden configuration
+ # If you want to use other strategies, that are not supported by Devise, or
+ # change the failure app, you can configure them inside the config.warden block.
+ #
+ # config.warden do |manager|
+ # manager.intercept_401 = false
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
+ # end
+end
View
218 config/initializers/devise.rb~
@@ -0,0 +1,218 @@
+# Use this hook to configure devise mailer, warden hooks and so forth.
+# Many of these configuration options can be set straight in your model.
+Devise.setup do |config|
+ config.sign_out_via = :get
+
+ # ==> Mailer Configuration
+ # Configure the e-mail address which will be shown in Devise::Mailer,
+ # note that it will be overwritten if you use your own mailer class with default "from" parameter.
+ config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
+
+ # Configure the class responsible to send e-mails.
+ # config.mailer = "Devise::Mailer"
+
+ # ==> ORM configuration
+ # Load and configure the ORM. Supports :active_record (default) and
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
+ # available as additional gems.
+ require 'devise/orm/active_record'
+
+ # ==> Configuration for any authentication mechanism
+ # Configure which keys are used when authenticating a user. The default is
+ # just :email. You can configure it to use [:username, :subdomain], so for
+ # authenticating a user, both parameters are required. Remember that those
+ # parameters are used only when authenticating and not when retrieving from
+ # session. If you need permissions, you should implement that in a before filter.
+ # You can also supply a hash where the value is a boolean determining whether
+ # or not authentication should be aborted when the value is not present.
+ config.authentication_keys = [ :login ]
+
+ # Configure parameters from the request object used for authentication. Each entry
+ # given should be a request method and it will automatically be passed to the
+ # find_for_authentication method and considered in your model lookup. For instance,
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
+ # config.request_keys = []
+
+ # Configure which authentication keys should be case-insensitive.
+ # These keys will be downcased upon creating or modifying a user and when used
+ # to authenticate or find a user. Default is :email.
+ config.case_insensitive_keys = [ :email ]
+
+ # Configure which authentication keys should have whitespace stripped.
+ # These keys will have whitespace before and after removed upon creating or
+ # modifying a user and when used to authenticate or find a user. Default is :email.
+ config.strip_whitespace_keys = [ :email ]
+
+ # Tell if authentication through request.params is enabled. True by default.
+ # It can be set to an array that will enable params authentication only for the
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
+ # enable it only for database (email + password) authentication.
+ # config.params_authenticatable = true
+
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
+ # It can be set to an array that will enable http authentication only for the
+ # given strategies, for example, `config.http_authenticatable = [:token]` will
+ # enable it only for token authentication.
+ # config.http_authenticatable = false
+
+ # If http headers should be returned for AJAX requests. True by default.
+ # config.http_authenticatable_on_xhr = true
+
+ # The realm used in Http Basic Authentication. "Application" by default.
+ # config.http_authentication_realm = "Application"
+
+ # It will change confirmation, password recovery and other workflows
+ # to behave the same regardless if the e-mail provided was right or wrong.
+ # Does not affect registerable.
+ # config.paranoid = true
+
+ # By default Devise will store the user in session. You can skip storage for
+ # :http_auth and :token_auth by adding those symbols to the array below.
+ # Notice that if you are skipping storage for all authentication paths, you
+ # may want to disable generating routes to Devise's sessions controller by
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
+ config.skip_session_storage = [:http_auth]
+
+ # ==> Configuration for :database_authenticatable
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
+ # using other encryptors, it sets how many times you want the password re-encrypted.
+ #
+ # Limiting the stretches to just one in testing will increase the performance of
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
+ # a value less than 10 in other environments.
+ config.stretches = Rails.env.test? ? 1 : 10
+
+ # Setup a pepper to generate the encrypted password.
+ # config.pepper = "34fe9dcafbfe00e16095f63f68048770e1199ac561be20d9c30ecc832858c77107fcdadde2af2ba2382d2d03e584a02d2b6ea68a4b39fd8d383795a634c3b83f"
+
+ # ==> Configuration for :confirmable
+ # A period that the user is allowed to access the website even without
+ # confirming his account. For instance, if set to 2.days, the user will be
+ # able to access the website for two days without confirming his account,
+ # access will be blocked just in the third day. Default is 0.days, meaning
+ # the user cannot access the website without confirming his account.
+ # config.allow_unconfirmed_access_for = 2.days
+
+ # If true, requires any email changes to be confirmed (exactly the same way as
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
+ # db field (see migrations). Until confirmed new email is stored in
+ # unconfirmed email column, and copied to email column on successful confirmation.
+ config.reconfirmable = true
+
+ # Defines which key will be used when confirming an account
+ # config.confirmation_keys = [ :email ]
+
+ # ==> Configuration for :rememberable
+ # The time the user will be remembered without asking for credentials again.
+ # config.remember_for = 2.weeks
+
+ # If true, extends the user's remember period when remembered via cookie.
+ # config.extend_remember_period = false
+
+ # Options to be passed to the created cookie. For instance, you can set
+ # :secure => true in order to force SSL only cookies.
+ # config.rememberable_options = {}
+
+ # ==> Configuration for :validatable
+ # Range for password length. Default is 6..128.
+ # config.password_length = 6..128
+
+ # Email regex used to validate email formats. It simply asserts that
+ # an one (and only one) @ exists in the given string. This is mainly
+ # to give user feedback and not to assert the e-mail validity.
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
+
+ # ==> Configuration for :timeoutable
+ # The time you want to timeout the user session without activity. After this
+ # time the user will be asked for credentials again. Default is 30 minutes.
+ # config.timeout_in = 30.minutes
+
+ # ==> Configuration for :lockable
+ # Defines which strategy will be used to lock an account.
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
+ # :none = No lock strategy. You should handle locking by yourself.
+ # config.lock_strategy = :failed_attempts
+
+ # Defines which key will be used when locking and unlocking an account
+ # config.unlock_keys = [ :email ]
+
+ # Defines which strategy will be used to unlock an account.
+ # :email = Sends an unlock link to the user email
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
+ # :both = Enables both strategies
+ # :none = No unlock strategy. You should handle unlocking by yourself.
+ # config.unlock_strategy = :both
+
+ # Number of authentication tries before locking an account if lock_strategy
+ # is failed attempts.
+ # config.maximum_attempts = 20
+
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
+ # config.unlock_in = 1.hour
+
+ # ==> Configuration for :recoverable
+ #
+ # Defines which key will be used when recovering the password for an account
+ # config.reset_password_keys = [ :email ]
+
+ # Time interval you can reset your password with a reset password key.
+ # Don't put a too small interval or your users won't have the time to
+ # change their passwords.
+ config.reset_password_within = 6.hours
+
+ # ==> Configuration for :encryptable
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
+ # REST_AUTH_SITE_KEY to pepper)
+ # config.encryptor = :sha512
+
+ # ==> Configuration for :token_authenticatable
+ # Defines name of the authentication token params key
+ # config.token_authentication_key = :auth_token
+
+ # ==> Scopes configuration
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
+ # "users/sessions/new". It's turned off by default because it's slower if you
+ # are using only default views.
+ # config.scoped_views = false
+
+ # Configure the default scope given to Warden. By default it's the first
+ # devise role declared in your routes (usually :user).
+ # config.default_scope = :user
+
+ # Configure sign_out behavior.
+ # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
+ # The default is true, which means any logout action will sign out all active scopes.
+ # config.sign_out_all_scopes = true
+
+ # ==> Navigation configuration
+ # Lists the formats that should be treated as navigational. Formats like
+ # :html, should redirect to the sign in page when the user does not have
+ # access, but formats like :xml or :json, should return 401.
+ #
+ # If you have any extra navigational formats, like :iphone or :mobile, you
+ # should add them to the navigational formats lists.
+ #
+ # The "*/*" below is required to match Internet Explorer requests.
+ # config.navigational_formats = ["*/*", :html]
+
+ # The default HTTP method used to sign out a resource. Default is :delete.
+ config.sign_out_via = :delete
+
+ # ==> OmniAuth
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
+ # up on your models and hooks.
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
+
+ # ==> Warden configuration
+ # If you want to use other strategies, that are not supported by Devise, or
+ # change the failure app, you can configure them inside the config.warden block.
+ #
+ # config.warden do |manager|
+ # manager.intercept_401 = false
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
+ # end
+end
View
57 config/locales/devise.en.yml
@@ -0,0 +1,57 @@
+# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
+
+en:
+ errors:
+ messages:
+ expired: "has expired, please request a new one"
+ not_found: "not found"
+ already_confirmed: "was already confirmed, please try signing in"
+ not_locked: "was not locked"
+ not_saved:
+ one: "1 error prohibited this %{resource} from being saved:"
+ other: "%{count} errors prohibited this %{resource} from being saved:"
+
+ devise:
+ failure:
+ already_authenticated: 'You are already signed in.'
+ unauthenticated: 'You need to sign in or sign up before continuing.'
+ unconfirmed: 'You have to confirm your account before continuing.'
+ locked: 'Your account is locked.'
+ invalid: 'Invalid email or password.'
+ invalid_token: 'Invalid authentication token.'
+ timeout: 'Your session expired, please sign in again to continue.'
+ inactive: 'Your account was not activated yet.'
+ sessions:
+ signed_in: 'Signed in successfully.'
+ signed_out: 'Signed out successfully.'
+ passwords:
+ send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
+ updated: 'Your password was changed successfully. You are now signed in.'
+ updated_not_active: 'Your password was changed successfully.'
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
+ confirmations:
+ send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
+ send_paranoid_instructions: 'If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
+ confirmed: 'Your account was successfully confirmed. You are now signed in.'
+ registrations:
+ signed_up: 'Welcome! You have signed up successfully.'
+ signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
+ signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
+ signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
+ updated: 'You updated your account successfully.'
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
+ destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
+ unlocks:
+ send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
+ unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
+ send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
+ omniauth_callbacks:
+ success: 'Successfully authenticated from %{kind} account.'
+ failure: 'Could not authenticate you from %{kind} because "%{reason}".'
+ mailer:
+ confirmation_instructions:
+ subject: 'Confirmation instructions'
+ reset_password_instructions:
+ subject: 'Reset password instructions'
+ unlock_instructions:
+ subject: 'Unlock Instructions'
View
8 config/routes.rb
@@ -1,4 +1,6 @@
ChadV2::Application.routes.draw do
+ devise_for :users
+
# The priority is based upon order of creation:
# first created -> highest priority.
@@ -11,7 +13,9 @@
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
- # resources :products
+ resources :voters
+ resources :candidates
+ resources :users
# Sample resource route with options:
# resources :products do
@@ -48,7 +52,7 @@
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
- # root :to => 'welcome#index'
+ root :to => 'voters#index'
# See how all your routes lay out with "rake routes"
View
61 config/routes.rb~
@@ -0,0 +1,61 @@
+ChadV2::Application.routes.draw do
+ devise_for :users
+
+ # The priority is based upon order of creation:
+ # first created -> highest priority.
+
+ # Sample of regular route:
+ # match 'products/:id' => 'catalog#view'
+ # Keep in mind you can assign values other than :controller and :action
+
+ # Sample of named route:
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
+ # This route can be invoked with purchase_url(:id => product.id)
+
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
+ resources :voters
+ resources :candidates
+
+ # Sample resource route with options:
+ # resources :products do
+ # member do
+ # get 'short'
+ # post 'toggle'
+ # end
+ #
+ # collection do
+ # get 'sold'
+ # end
+ # end
+
+ # Sample resource route with sub-resources:
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
+
+ # Sample resource route with more complex sub-resources
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get 'recent', :on => :collection
+ # end
+ # end
+
+ # Sample resource route within a namespace:
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
+ # end
+
+ # You can have the root of your site routed with "root"
+ # just remember to delete public/index.html.
+ root :to => 'voters#index'
+
+ # See how all your routes lay out with "rake routes"
+
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
+ # Note: This route will make all actions in every controller accessible via GET requests.
+ # match ':controller(/:action(/:id))(.:format)'
+end
View
46 db/migrate/20120628205255_devise_create_users.rb
@@ -0,0 +1,46 @@
+class DeviseCreateUsers < ActiveRecord::Migration
+ def change
+ create_table(:users) do |t|
+ ## Database authenticatable
+ t.string :email, :null => false, :default => ""
+ t.string :encrypted_password, :null => false, :default => ""
+
+ ## Recoverable
+ t.string :reset_password_token
+ t.datetime :reset_password_sent_at
+
+ ## Rememberable
+ t.datetime :remember_created_at
+
+ ## Trackable
+ t.integer :sign_in_count, :default => 0
+ t.datetime :current_sign_in_at
+ t.datetime :last_sign_in_at
+ t.string :current_sign_in_ip
+ t.string :last_sign_in_ip
+
+ ## Confirmable
+ # t.string :confirmation_token
+ # t.datetime :confirmed_at
+ # t.datetime :confirmation_sent_at
+ # t.string :unconfirmed_email # Only if using reconfirmable
+
+ ## Lockable
+ # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
+ # t.datetime :locked_at
+
+ ## Token authenticatable
+ # t.string :authentication_token
+
+
+ t.timestamps
+ end
+
+ add_index :users, :email, :unique => true
+ add_index :users, :reset_password_token, :unique => true
+ # add_index :users, :confirmation_token, :unique => true
+ # add_index :users, :unlock_token, :unique => true
+ # add_index :users, :authentication_token, :unique => true
+ end
+end
View
5 db/migrate/20120628205442_add_username_to_users.rb
@@ -0,0 +1,5 @@
+class AddUsernameToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :username, :string
+ end
+end
View
9 db/migrate/20120628210643_create_candidates.rb
@@ -0,0 +1,9 @@
+class CreateCandidates < ActiveRecord::Migration
+ def change
+ create_table :candidates do |t|
+ t.integer :id
+ t.string :name
+ t.timestamps
+ end
+ end
+end
View
8 db/migrate/20120628210643_create_candidates.rb~
@@ -0,0 +1,8 @@
+class CreateCandidates < ActiveRecord::Migration
+ def change
+ create_table :candidates do |t|
+
+ t.timestamps
+ end
+ end
+end
View
9 db/migrate/20120628210650_create_votes.rb
@@ -0,0 +1,9 @@
+class CreateVotes < ActiveRecord::Migration
+ def change
+ create_table :votes do |t|
+ t.integer :candidate_id
+ t.integer :voter_id
+ t.timestamps
+ end
+ end
+end
View
8 db/migrate/20120628210650_create_votes.rb~
@@ -0,0 +1,8 @@
+class CreateVotes < ActiveRecord::Migration
+ def change
+ create_table :votes do |t|
+
+ t.timestamps
+ end
+ end
+end
View
9 db/migrate/20120628210838_create_voters.rb
@@ -0,0 +1,9 @@
+class CreateVoters < ActiveRecord::Migration
+ def change
+ create_table :voters do |t|
+ t.integer :id
+ t.string :name
+ t.timestamps
+ end
+ end
+end
View
8 db/migrate/20120628210838_create_voters.rb~
@@ -0,0 +1,8 @@
+class CreateVoters < ActiveRecord::Migration
+ def change
+ create_table :voters do |t|
+
+ t.timestamps
+ end
+ end
+end
View
54 db/schema.rb
@@ -0,0 +1,54 @@
+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20120628210838) do
+
+ create_table "candidates", :force => true do |t|
+ t.string "name"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "users", :force => true do |t|
+ t.string "email", :default => "", :null => false
+ t.string "encrypted_password", :default => "", :null => false
+ t.string "reset_password_token"
+ t.datetime "reset_password_sent_at"
+ t.datetime "remember_created_at"
+ t.integer "sign_in_count", :default => 0
+ t.datetime "current_sign_in_at"
+ t.datetime "last_sign_in_at"
+ t.string "current_sign_in_ip"
+ t.string "last_sign_in_ip"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "username"
+ end
+
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
+ add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
+
+ create_table "voters", :force => true do |t|
+ t.string "name"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "votes", :force => true do |t|
+ t.integer "candidate_id"
+ t.integer "voter_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+end
View
BIN  public/.DS_Store
Binary file not shown
View
11 test/fixtures/candidates.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+# This model initially had no columns defined. If you add columns to the
+# model remove the '{}' from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one: {}
+# column: value
+#
+two: {}
+# column: value
View
11 test/fixtures/users.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+# This model initially had no columns defined. If you add columns to the
+# model remove the '{}' from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one: {}
+# column: value
+#
+two: {}
+# column: value
View
11 test/fixtures/voters.yml
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+# This model initially had no columns defined. If you add columns to the
+# model remove the '{}' from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one: {}
+# column: value
+#
+two: {}
+# column: value
View
11 test/fixtures/votes.yml
@@ -0,0 +1,11 @@
+# Read about fixtu