{"id":13484070,"url":"https://github.com/codemancers/rapidfire","last_synced_at":"2026-04-02T11:37:54.229Z","repository":{"id":8076214,"uuid":"9489171","full_name":"codemancers/rapidfire","owner":"codemancers","description":"Making dynamic surveys should be easy!","archived":false,"fork":false,"pushed_at":"2024-12-22T06:47:45.000Z","size":572,"stargazers_count":328,"open_issues_count":18,"forks_count":142,"subscribers_count":31,"default_branch":"master","last_synced_at":"2026-02-20T07:17:18.997Z","etag":null,"topics":["rails","ruby","ruby-on-rails","survey-app","survey-form","survey-solutions","surveys","surveys-management"],"latest_commit_sha":null,"homepage":"https://rapidfire.fly.dev/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codemancers.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-04-17T04:29:28.000Z","updated_at":"2026-01-13T22:06:13.000Z","dependencies_parsed_at":"2023-01-13T14:37:38.836Z","dependency_job_id":"b134a33d-1cdb-4ffe-8049-97bc7e0b3382","html_url":"https://github.com/codemancers/rapidfire","commit_stats":{"total_commits":301,"total_committers":27,"mean_commits":"11.148148148148149","dds":0.5049833887043189,"last_synced_commit":"be4012be66c8a3df44e6ee21f1ade8d1cfcc068b"},"previous_names":["codemancers/rapidfire","code-mancers/rapidfire"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/codemancers/rapidfire","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemancers%2Frapidfire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemancers%2Frapidfire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemancers%2Frapidfire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemancers%2Frapidfire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codemancers","download_url":"https://codeload.github.com/codemancers/rapidfire/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemancers%2Frapidfire/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31305706,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T09:48:21.550Z","status":"ssl_error","status_checked_at":"2026-04-02T09:48:19.196Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rails","ruby","ruby-on-rails","survey-app","survey-form","survey-solutions","surveys","surveys-management"],"created_at":"2024-07-31T17:01:18.966Z","updated_at":"2026-04-02T11:37:54.209Z","avatar_url":"https://github.com/codemancers.png","language":"Ruby","readme":"# Rapidfire\n\nOne stop solution for all survey related requirements! Its tad easy!\n\nThis gem supports:\n\n- **rails**: 7.0, 7.1, 7.2 and 8.0\n- **ruby**: 3.1, 3.2 and 3.3\n\nNOTE: Some combinations won't be supported. Please check CI for the ignored ones.\n\nA simple implementaiton of this gem can be found at [https://rapidfire.fly.dev](https://rapidfire.fly.dev).\nAnd the source code of application is [https://github.com/code-mancers/rapidfire-app](https://github.com/code-mancers/rapidfire-app).\n\n## Installation\n\nAdd this line to application's Gemfile:\n\n```rb\ngem 'rapidfire'\n```\n\nAnd then execute:\n\n```shell\n$ bundle install\n$ bundle exec rake rapidfire:install:migrations\n$ bundle exec rake db:migrate\n```\n\nRapidfire views can also be customized. This command copies the views into `app/views` directory:\n\n```sh\n$ bundle exec rails generate rapidfire:views\n```\n\nRapidfire locales (i18n) files can also be customized. The command is:\n\n```sh\n$ bundle exec rails generate rapidfire:locales\n```\n\n## Usage\n\nAdd this line to `config/routes.rb` file, thats good enough\n\n```rb\nmount Rapidfire::Engine =\u003e \"/rapidfire\"\n```\n\nPlease point the browser to [http://localhost:3000/rapidfire](http://localhost:3000/rapidfire)\n\nAll rapidfire controllers inherit from your `ApplicationController`. So define 2\nmethods `current_user` and `can_administer?` on your `ApplicationController`\n\n1. `current_user` : the user who is answering the survey. can be `nil`\n2. `can_administer?` : a method which determines whether current user can\n   create/update survey questions.\n\nTypical implementation would be:\n\n```rb\nclass ApplicationController \u003c ActionController::Base\n  def current_user\n    @current_user ||= User.find(session[:user_id])\n  end\n\n  def can_administer?\n    current_user.try(:admin?)\n  end\nend\n```\n\nIt also will assume that whatever `current_user` returns above will respond to a method called `survey_name`.\n\nThat method should return the name that is associated with the results. For example:\n\n```rb\nclass User\n  def survey_name\n    \"#{last_name}, #{first_name}\"\n  end\nend\n```\n\nIf the application is using authentication gems like Devise, Devise will automatically provide `current_user`\nhelper for free. There is no need to define it\n\n### Override\n\nOverride path to redirect after answer the survey\n\n```ruby\n# my_app/app/decorators/controllers/rapidfire/attempts_controller_decorator.rb\nRapidfire::AttemptsController.class_eval do\n  def after_answer_path_for\n    main_app.root_path\n  end\nend\n```\n\n### Routes Information\n\nOnce this gem is mounted on, say at 'rapidfire', it generates several routes\nThey can be listed by running `bundle exec rake routes`.\n\n1. The `root_path` i.e `localhost:3000/rapidfire` always points to list of\n   surveys {they are called question groups}. Admin can manage surveys, and\n   any user {who cannot administer} can see list of surveys.\n2. Optionally, each survey can by answered by visiting this path:\n\n   ```\n   localhost:3000/rapidfire/surveys/\u003csurvey-id\u003e/attempts/new\n   ```\n\n   This url can be distributed so that survey takers can attempt the survey\n\n3. If you have an established application that uses route helpers and/or the\n   `url_for([@model1, @model2])` style, you can include your route helpers in\n   RapidFire by adding `config/initializers/rapidfire.rb` with the\n   following content:\n\n   ```ruby\n   Rails.application.config.after_initialize do\n     Rails.application.reload_routes!\n\n     Rapidfire::ApplicationController.class_eval do\n       main_app_methods = Rails.application.routes.url_helpers.methods\n       main_app_route_methods = main_app_methods.select{|m| m =~ /_url$/ || m =~ /_path$/ }\n       main_app_route_methods.each do |m|\n         define_method m do |*args|\n           main_app.public_send(m, *args)\n         end\n         helper_method m\n       end\n     end\n   end\n   ```\n\n### Survey Results\n\nThere is an API for fetching the results. This is not efficient, but is provided for the sake\nof quickly aggregating survey results\n\n```\nGET /rapidfire/surveys/\u003csurvey-id\u003e/results\n```\n\nThis new api supports two formats: `html` and `json`. The `json` format can be used with any\njavascript based chart solutions like Chart.js. An example can be seen\n[here](https://github.com/codemancers/rapidfire-app).\n\nDiving into details of `json` format, all the questions can be categorized into\none of the two categories:\n\n1. **aggregatable**: questions like checkboxes, selects, radio buttons fall into\n   this category.\n2. **non-aggregatable**: questions like long answers, short answers, date, numeric\n   etc.\n\nAll the aggregatable answers will be returned in the form of hash, and the\nnon-aggregatable answers will be returned in the form of an array. A typical json\noutput will be like this:\n\n```json\n[\n  {\n    \"question_type\": \"Rapidfire::Questions::Radio\",\n    \"question_text\": \"Who is author of Waiting for godot?\",\n    \"results\": {\n      \"Sublime\": 1,\n      \"Emacs\": 1,\n      \"Vim\": 1\n    }\n  },\n  {\n    \"question_type\": \"Rapidfire::Questions::Checkbox\",\n    \"question_text\": \"Best rock band?\",\n    \"results\": {\n      \"Led Zeppelin\": 2\n    }\n  },\n  {\n    \"question_type\": \"Rapidfire::Questions::Date\",\n    \"question_text\": \"When is your birthday?\",\n    \"results\": [\"04-02-1983\", \"01/01/1970\"]\n  },\n  {\n    \"question_type\": \"Rapidfire::Questions::Long\",\n    \"question_text\": \"If Apple made a android phone what it will be called?\",\n    \"results\": [\"Idude\", \"apdroid\"]\n  },\n  {\n    \"question_type\": \"Rapidfire::Questions::Numeric\",\n    \"question_text\": \"Answer of life, universe and everything?\",\n    \"results\": [\"42\", \"0\"]\n  },\n  {\n    \"question_type\": \"Rapidfire::Questions::Select\",\n    \"question_text\": \"Places you want to visit after death\",\n    \"results\": {\n      \"Iran\": 2\n    }\n  }\n]\n```\n\n## How it works\n\nThis gem gives on the fly access to create questions under a survey. Once the survey is\ncreated, questions can be added to the survey. Every survey will have a url which can\nbe can passed around to others to take the survey.\n\nThe typical flow about how to use this gem is:\n\n1. Create a survey by giving it a name.\n2. Once the survey is created, start adding questions to the survey\n3. Create a question by clicking on add new, and there will be several options\n   Each question will have a type\n\n   - **Checkbox** Create a question which contains multiple checkboxes with the\n     options that you provide in `answer options` field. Note that each option\n     should be on a separate line.\n   - **Date** It takes date as an answer\n   - **Long** It needs a description as answer. Renders a textarea.\n   - **Numeric** It takes a number as an answer\n   - **Radio** It renders set of radio buttons by taking answer options.\n   - **Select** It renders a dropdown by taking answer options.\n   - **Short** It takes a string as an answer. Short answer.\n   - **File** It renders a file input which can take only 1 file.\n   - **MultiFile** It renders a file input which can take multile files.\n\n4. Once the type is filled, optionally other details can be filled:\n\n   - **Question text** What is the question?\n   - **Answer options** Give options separated by newline for questions of type\n     checkbox, radio buttons or select.\n   - **Answer presence** Should you mandate answering this question?\n   - **min and max length** Checks whether answer if in between min and max length.\n     Ignores if blank.\n   - **greater than and less than** Applicable for numeric question where answer\n     is validated with these values.\n\n5. Once the questions are populated, a url will be created which can be shared\n6. Note that answers fail to persist if the criteria provided while creating the\n   questions fail.\n\n## Notes on upgrading\n\n##### Adding multitenancy support\n\n```shell\n$ rake rapidfire:upgrade:migrations:multitenancy\n```\n\n##### Upgrading from 2.1.0 to 3.0.0\n\nSome table names have changed:\n\n- `rapidfire_question_groups` to `rapidfire_surveys`, and\n- `rapidfire_answer_groups` to `rapidfire_attempts`.\n\nRun this rake task to do this change automatically\n\n```shell\n$ rake rapidfire:upgrade:migrations:from210to300\n```\n\n##### Upgrading from 1.2.0 to 2.0.0\n\nThe default delimiter which is used to store options for questions like select\ninput, multiple answers for checkbox question is comma (,). This resulted in\nproblems where gem is unable to parse options properly if answers also contain\ncommas. For more information see [issue-19](https://github.com/code-mancers/rapidfire/issues/19).\n\nStarting from version `2.0.0` default delimiter is changed to `\\r\\n`, but a\nconfiguration is provided to change the delimiter. Please run this rake task\nto make existing questions or stored answers to use new delimiter.\n\nNOTE: Please take database backup before running this rake task.\n\n```rb\nbundle exec rake rapidfire:change_delimiter_from_comma_to_srsn\nbundle exec rake rapidfire:change_delimiter_from_comma_to_srsn\n```\n\nIf this change is not feasible rightaway, and the application needs to use comma\nas delimiter, then please use this initializer, but be warned that in future\ndelimiter will be hardcoded to `\\r\\n`:\n\n```rb\n# /\u003cpath-to-app\u003e/config/initializers/rapidfire.rb\n\nRapidfire.config do |config|\n  config.answers_delimiter = ','\nend\n```\n\n## TODO\n\n1. Add ability to sort questions, so that order is preserved.\n\n## Contributing\n\n1. Fork it\n2. Create a feature branch (`git checkout -b my-new-feature`)\n3. Commit all the changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","funding_links":[],"categories":["Form Builder"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemancers%2Frapidfire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodemancers%2Frapidfire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemancers%2Frapidfire/lists"}