Hi all

I've done a few tutorials and small simple apps and would now like to
make a somewhat larger application at my college to take student
assesments. I just can't figure out where some application logic
should go... Maybe someone could give me some pointers?

This is what I want to do: a student or teacher logs in on the site. A
student can take an assesment of 70 questions (always the same 70
questions) or will see the results of his previous assesment. A
teacher will see the results of all take assesments by the students.
The application will process results based on the answers when needed
and generate textual advise on student attitudes (texts are known in
advance an won't change themselves). Authentication will be done on
active directory through Devise.

I think I need 2 models: users (has_many assesments) and assesments
(belongs_to users). I'm not sure about the controllers though. Should
I put all logic in a user and assesment controller or is it useful or
better to put logic in seperate controllers (show_own_results,
show_all_results, calculate_result, etc) or make a seperate controller
called results and put my methods in there?

Sorry if this is a stupid question, I've just started to learn and
have been breaking my head on this for days. I've changed my mind so
many times about what I should do best but I don't seem to find the
right solution for the logical way to do this in Rails. This is my
first framework development btw, I'm not used to web programming.

Any help is greatly appreciated!

Jurgen

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Fidel Viegas at Jun 25, 2012 at 11:17 pm
    Hi Jurgen,
    On 23-06-2012 20:32, Jurgen Raedts wrote:
    Hi all

    I've done a few tutorials and small simple apps and would now like to
    make a somewhat larger application at my college to take student
    assesments. I just can't figure out where some application logic
    should go... Maybe someone could give me some pointers?
    The business logic belongs in the model. You should keep your
    controllers to a minimum. Some people do a mix, but a I personally, and
    I believe the majority, put the business logic in the model. The role of
    the controller is to act as a broker between the view and the model. It
    gets the data from the model and hands it over to the view.

    If you do a search on Google you should find quite a lot of useful
    information, and I guess your question answered in a few different
    places. But read the guides in http://guides.rubyonrails.org and go for
    the online book Rails Tutorial that can be read on
    http://ruby.railstutorial.org/ruby-on-rails-tutorial-book, or if you
    prefer to read offline, you can purchase the pdf.
    This is what I want to do: a student or teacher logs in on the site. A
    student can take an assesment of 70 questions (always the same 70
    questions) or will see the results of his previous assesment. A
    teacher will see the results of all take assesments by the students.
    The application will process results based on the answers when needed
    and generate textual advise on student attitudes (texts are known in
    advance an won't change themselves). Authentication will be done on
    active directory through Devise.

    I think I need 2 models: users (has_many assesments) and assesments
    (belongs_to users). I'm not sure about the controllers though. Should
    I put all logic in a user and assesment controller or is it useful or
    better to put logic in seperate controllers (show_own_results,
    show_all_results, calculate_result, etc) or make a seperate controller
    called results and put my methods in there?
    As I mentioned above you should place the logic in the model. You should
    start with a basic authentication, and then add roles to your users so
    that you can control what they can or cannot see. I am not that
    experienced with Devise, but I know if plays well with CanCan, which is
    an authorization plugin that will let you control who has access to what
    and who doesn't. In your case you could have two roles: student and
    teacher. users with student role can take assessments and view the
    results. The teacher role can see the results and generate reports on
    that (or textual advise as you call it)
    Sorry if this is a stupid question, I've just started to learn and
    have been breaking my head on this for days. I've changed my mind so
    many times about what I should do best but I don't seem to find the
    right solution for the logical way to do this in Rails. This is my
    first framework development btw, I'm not used to web programming.
    Don't worry. Just go through the tutorial found in
    http://guides.rubyonrails.org and then read the Rails Tutorial book.
    That should clear your doubts.

    If after reading those references you still have questions, do a search
    on Google first, as you will get your answers faster. I am actually a
    long time member of this mailing list, and it has been a while since I
    posted any question here. I use mainly Google, as Rails is one of the
    frameworks with extensive documentation and online help. But, if you
    don't find your answers than send your questions here and you should be
    able to get some help. But as I said before, you may find your answers
    faster from a Google search.

    Hope my reply to your questions was useful to you.

    Good luck with your Ruby on Rails learning quest.

    Regards,

    Fidel.


    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Fidel Viegas at Jun 25, 2012 at 11:27 pm
    Hi Jurgen,

    I had forgotten about this tutorial on MVC, which you can download from
    http://elite.polito.it/files/courses/02NPYPD/lucidi/moduloA/01-MVC.pdf.
    It doesn't give you any practicle sample project, but it should make you
    understand the whole MVC concept.

    Regards,

    Fidel.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJun 24, '12 at 9:03p
activeJun 25, '12 at 11:27p
posts3
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Fidel Viegas: 2 posts Jurgen Raedts: 1 post

People

Translate

site design / logo © 2021 Grokbase