Skip to content
This repository

Allow your site's maintainers to easily create forms.

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 db
Octocat-spinner-32 lib
Octocat-spinner-32 script
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.markdown
Octocat-spinner-32 Rakefile
Octocat-spinner-32 ask.gemspec Merge branch 'master' of January 12, 2014


Ask is a Rails engine that provides tools to simplify the process of letting your app's users build forms for things like questionnaires or surveys.


  • Rails 3.1 or higher
  • jQuery
  • jQuery UI
  • Uses Carrierwave for uploads

More information will be on the wiki.


Add to your Gemfile:

gem 'ask'

In your terminal run:

rake ask_engine:install:migrations
rake db:migrate


Ask needs to be tied to two models in your application: an "asker" and an "answerer". The asker model should be the model that has questions, such as a Survey or Event. The answerer model should be the model that has answers to the questions such as a SurveySubmission or an EventRegistration.

In your asker model add:


In your answerer model add:


In your asker form views, inside an already defined form_for helper add:

<%= render(:partial => 'asker/form', :locals => { :f => f }) %>

In your answerer form views, inside an already defined form_for helper add:

<%= render(:partial => 'answerer/form', :locals => { :f => f }) %>

In your javascript manifest file add:

//= require ask

In your stylesheet manifest file add:

*= require ask  

If you want your form to start with one question, you can do the following... In your asker controller's new and edit methods you'll need to build the first question and choice. The best way to do this is create a private method:

def build_questions

Then at the top of your asker controller, include:

before_filter :build_questions, :only => [:new, :edit]
# or you can call the build_questions method inside the new or edit controller

In your answerer controller's new and edit methods you'll need to call build_or_create_answers and pass it in the appropriate questions. Such as:

@event_registration.build_or_create_answers @event_registration.event.questions

Finally you'll need to define an asker method on your answerer model, like so:

class EventRegistration < ActiveRecord::Base
  def asker  
    return event  


If you want to changed the default whitelisted file types for upload questions, just drop this into an initializer file.

Ask.configure do |config|
  @upload_whitelist = %w(jpg jpeg gif png doc docx txt pdf xls xlsx zip)

Build Status

Build Status


MIT License

Something went wrong with that request. Please try again.