Sha256: a7802b42f0b09c59ad7b422ac1b7d557900dfa8afb071c60fb6dd00a3973d7f4
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
Ask === 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. Requirements ------------ - Rails 3.1 or higher Installation ------------ Add to your Gemfile: gem 'ask' In your terminal run: bundle Usage ----- 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: acts_as_asker In your answerer model add: acts_as_answerer 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 */ In your answerer controller's `new` and `edit` methods you'll want 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 end end License ------- MIT License
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ask-0.1.0 | README.markdown |