README.markdown in ask-0.3.1 vs README.markdown in ask-0.4.0
- old
+ new
@@ -3,10 +3,12 @@
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
+- jQuery
+- jQuery UI
Installation
------------
Add to your Gemfile:
@@ -46,21 +48,23 @@
/*
*= 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
@event.questions.build
@event.questions.each{|q| q.choices.build}
end
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 want to call `build_or_create_answers` and pass it in the appropriate questions. Such as:
+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: