Multiple choice questions scaffold?

Hello all,

I’m in my second day of working through the various Ruby on Rails
tutorials, I’m already hugely impressed by the potential speed of
developing database driven sites, especially via the use of scaffolds.

Which brings me on to my first question (apologies if it’s a simple one,
but like I said it is only my second day!)

I am aiming to develop an application that serves a user with a set
number of multiple choice questions, chosen from a random set stored in
MySQL.

Is there an existing scaffold, or close fit, that I could use to rapidly
develop this application?

Many thanks for your help.

No, scaffolding is for creating simple interfaces for your models. You
will have to create the database tables to suit and then run your
scaffold, then work out your logic for displaying the questions
randomly.


Timothy J.
www.foundinteractive.com

Thanks Timothy, makes sense.

Is there a list of available scaffolds? Or are they all based on
specific database table layouts?

Yes, the scaffold command just looks at your DB tables, and creates the
interface accordingly.


Timothy J.
www.foundinteractive.com

unknown wrote:

I think you’re misunderstanding scaffolds.

Yup, I had misunderstood. Set on the straight and narrow now though :slight_smile:

Thanks guys.

I think you’re misunderstanding scaffolds. There are no different
scaffolds for different tasks. All a scaffold does is list all the
records in a given table. For example, if you have a table called
“questions”, you would use ‘ruby script/generate scaffold Question’.
The scaffold would generate a list of all the questions in the table,
and give an interface for adding, deleting and editing them.
So in the infamous rails video with the blog, when he typed
‘script/generate scaffold blog’, that’s because the table was called
‘blogs’, not because there’s a built in scaffold for making a blog.
The scaffold can be very easily adapted for making some things very
simple applications, such as a blog, but for anything else, it’s just
a starting point.
Hope this helps.
-Nathan