Commit c1f74980cfda161373d5858b15a15a5d90f3735f

Authored by Lee Dykes
1 parent c4acbd42
Exists in master

Getting some documentation going here

Showing 2 changed files with 54 additions and 12 deletions   Show diff stats
MIT-LICENSE 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +The MIT License (MIT)
  2 +
  3 +Copyright (c) 2015 Global Impact
  4 +
  5 +Permission is hereby granted, free of charge, to any person obtaining a copy
  6 +of this software and associated documentation files (the "Software"), to deal
  7 +in the Software without restriction, including without limitation the rights
  8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9 +copies of the Software, and to permit persons to whom the Software is
  10 +furnished to do so, subject to the following conditions:
  11 +
  12 +The above copyright notice and this permission notice shall be included in
  13 +all copies or substantial portions of the Software.
  14 +
  15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21 +THE SOFTWARE.
0 22 \ No newline at end of file
... ...
README.md
1 1 # Surveyable
2 2  
3   -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/surveyable`. To experiment with that code, run `bin/console` for an interactive prompt.
4   -
5   -TODO: Delete this and the text above, and describe your gem
  3 +Simple gem to deal with attaching 'surveys' to existing models. This involves question and answer types defined here.
6 4  
7 5 ## Installation
8 6  
... ... @@ -22,15 +20,38 @@ Or install it yourself as:
22 20  
23 21 ## Usage
24 22  
25   -TODO: Write usage instructions here
26   -
27   -## Development
28   -
29   -After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30   -
31   -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32   -
  23 +Run migrations (to be included as files soon)
  24 +
  25 +### Migrations
  26 +
  27 + create_table :questions do |t|
  28 + t.integer :survey_id
  29 + t.string :survey_type
  30 + t.text :text
  31 + t.string :type
  32 + t.boolean :required
  33 + end
  34 + create_table :answers do |t|
  35 + t.integer :question_id
  36 + t.integer :response_id
  37 + t.string :response_type
  38 + t.text :text
  39 + t.integer :answer_choice_id
  40 + t.index [:response_id,:response_type]
  41 + end
  42 + create_table :answer_choices do |t|
  43 + t.integer :question_id
  44 + t.text :text
  45 + t.index :question_id
  46 + end
  47 +
  48 +### Attach to models
  49 +Put 'acts_as_survey' in your survey class (the model that needs custom questions).
  50 +Put 'acts_as_response' in your response class (the model that your answers will attach to).
33 51 ## Contributing
34 52  
35   -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/surveyable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
  53 +Bug reports and pull requests are welcome on GitHub at https://github.com/globalimpact/surveyable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
  54 +
  55 +##License
36 56  
  57 +MIT License. Copyright 2015 Global Impact. https://charity.org
37 58 \ No newline at end of file
... ...