I’m building my first ever rails app, which consists of various ‘trivia
challenges’ based around tv shows, which the user can complete, and then
receives ‘gamified’ rewards via the merit gem.
I’ve created a user model, but then I got stuck thinking about how to
model the challenges.
There will be 3-5 challenge sets/courses, each consisting of 10-20
quizzes (where the user briefly reviews or learns the info and then is
quizzed on it). However I can’t decide how this integrates with the
REST/CRUD actions (i’m not creating, updating, or destroying anything…
they’re just doing a quiz and getting badges and xp when they complete
them…).
Any advice on how to model this, or alter my perspective somehow? Thanks
in advance!
REST/CRUD actions (i’m not creating, updating, or destroying anything…
they’re just doing a quiz and getting badges and xp when they complete
them…).
Do the quiz information and challenge set data change over time? If
so then you need to create, update and destroy them.
What other information needs to be remembered from one session to the
next?
Colin
Hi Colin
The quizzes will remain the same, although obviously I will add new ones
myself over time. The user just reads some information (which could be
on the same page as the quiz, using a little ajax box with multiple
tabs), does a small quiz, and all that needs to be remembered is a
boolean which says whether that quiz has been successfully completed or
not (I think).
The quizzes will remain the same, although obviously I will add new ones
myself over time.
So you need to be able to create, edit, destroy those. So pretty
standard REST interface there. You could use the rails scaffold for
this as it is only an admin interface rather than a user i/f.
The user just reads some information (which could be
on the same page as the quiz, using a little ajax box with multiple
tabs), does a small quiz, and all that needs to be remembered is a
boolean which says whether that quiz has been successfully completed or
not (I think).
So that is a boolean saying that this user has completed that quiz?
So you could use a join table between users and quiz for that.
and then if it has multiple pages I guess I’d need it to be /comedy/1/3
or whatever.
Don’t worry about what the urls look like, work out what functionality
you want, and go from there. The requirements drive the urls not the
other way round. Think of it as an application not a series of web
pages.