An example polling application to capture UK voter intention
This Rails 3.2 application asks a UK voter their constituency and asks them their voting intention.
The application then displays results for any chosen constituency, and for the nation as a whole.
Ruby 1.9. This has been tested using Ruby 1.9.2-p290. There's a .rvmrc file in the root.
MongoDB running on localhost (or edit config/mongoid.yml).
Clone the app:
git clone git://github.com/andyt/straw-poll.git
Edit config/mongoid.yml if necessary, and seed the database:
Run the server:
Connect to localhost:3000 in a browser.
If you'd like to poke around the seed data, RailsAdmin is mounted at localhost:3000/admin (user email@example.com, password 'password')
Running the tests
Test coverage is limited to basic association tests on the models.
The application skeleton was created using the template specified below:
$ rails new mysociety -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-mongoid-devise-template.rb -T -O
and answering questions as required.
There is no mechanism to determine repeat voting, as I considered this out-of-scope. Any solution (whether via cookies, or registration) could be easily circumvented by someone determined to bias results.