views:

559

answers:

4

Can't find any tutorial for creating a simple questionnaire system on RoR (without using Finite State Machines).

I think the Model is simple:

  • Quizzes (have many Questions)
  • Questions (belong to Quizzes, have many Choices, have one Answer)
  • Choices (belong to Questions)
  • Responses (belong to Users, belong to Questions)
  • Users (have many Responses).

User logs in (session is created), chooses some Quiz (Questions which belong to this Quiz are shown). User navigates through the Questions, makes his choice (Response), finishes the Quiz. Responses are compared with Answers. System shows some results.

But as I'm new to Rails it is difficult for me to make it work properly. Any help? Maybe there is a tutorial where some similar app is created?

+1  A: 

indeed a nice setup for doing a tutorial. I just have started a tutorial on this here:

basic rails survey tutorial part 1

Anyway, if you want to understand more behind the basics of Rails, there are many tutorials around. One of the best is the "Agile Web development with Rails" book from Pragmatic Programmers (it's about developing a small shop application). Then there are the screencasts by Ryan Bates among which there is some blog application. There are very good screencasts on peepcode about a book blog application.

By the way, you can see Rails as domain-specific language based on Ruby for doing web applications. Domain-specific language is the same concept as DRY (don't repeat yourself), something you will see all over in Rails, and which seems to be easier implemented in Ruby than in other languages.

poseid
Thank you, I'll check it out.Well, I've read some books (e.g. Simply Rails). It is easy for me to understand already written RoR apps, but still difficult to figure out how to write my own .
kovrik
yes. it takes some time to understand the framework. I have added a m:n relationship between questions and choices in part I, and added part II around the views and controllers.
poseid
+2  A: 

Actually, I think this might really help you out: Railscast Tutorial

It's actually about nested forms and uses a questionnaire as the example. Check that out ;-)

Hock
Thanks ! Hope that will help me.
kovrik
A: 

I want to write the same application, since I haven't updated my knowledge much about the restful/resourceful. I can't give suggestions on code structures.

For me, the simplest way to is incorporate the RestfulAuthentication plugin, and to make Quizzes/Questions/Choices/Responses resourceful, also to create those many-to-many relations with extra models in order to record extra info like user_id.

Quite similar to the Hock's tutorials.

neilalaer
+1  A: 

Maybe you should try out http://github.com/breakpointer/surveyor . Looks like something you are looking for. I just came across it

Jeroen van Dijk