Best way to do this RESTfully and right : Ruby on Rails?

If you want a manager to update/modify the checkboxes and the technicians to fill in the forms, you need a couple of extra tables. One containing the questions and one containing the values that are checked. Also, it seems better to split the controller into two, one for each user type.

If you want a manager to update/modify the checkboxes and the technicians to fill in the forms, you need a couple of extra tables. One containing the questions and one containing the values that are checked. Also, it seems better to split the controller into two, one for each user type: For the manager part you can simply make a controller like any other controller: using the index action to show all questions and the edit/update/etc actions to modify them.

For the technician part you need to define a project table, containing some information about the project the technician is working on. And a checkboxes table containing the project_id and the checkbox_ids, in order to link the checkboxes to a certain project. See A Guide to Active Record Associations for more information about creating associations between tables.

Thanks for the response Vegar. I've been trying to wrap my head around the has_many :through relationships for some time. I do know how to do them, but I have a hard time understanding how to access them all through different controllers/views and such.

Many tutorials show how to associate them in the models, but not in the views/controllers. I have successfully done a has_many_belongs_to relationship, which I believe creates the XXX_ids for me, but of course does not allow additional info put in the relationship. I'll mash around in Aptana to see if I can figure this out.

– Branden Silva Jan 28 '10 at 11:00 I've updated the thread with a picture too. Just to make sure we are on the same page. – Branden Silva Jan 28 '10 at 11:40 You do not need to build a controller for each Model.

You need controllers for the pages you want to show. So one for the managers and one for the technicians. The associations are automatically fetched when fetching the base record, using the autmatically added id field(s).

– Veger Jan 28 '10 at 11:47 Gotcha. So I would then put the questions (that the manager created) within the technician area so they can answer them? I'm guessing the best place to put these would be the new & edit actions.

This way the technician can add new responses to the questions, as well as edit existing responses. – Branden Silva Jan 28 '10 at 12:06 Something like that yes – Veger Jan 28 '10 at 12:14.

Without looking at this further, I'm willing to bet you want form_for checklist. Question and POST to questions_controller, which would use the #update action.

It's only the checklist controller that exists. So I would put this above information in the index page, and then have the form_for action POST to the update action? Do I just use :method => POST on the form_for tag?

How do I go about having it update itself when the form_for submit button is clicked? – Branden Silva Jan 28 '10 at 10:03 Your answer does not seem to help at all... At least I really do not understand what you are saying. – Veger Jan 28 '10 at 10:32 I appreciate your response scott, even if it wasn't what I needed.

– Branden Silva Jan 28 '10 at 11:28.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions