I have been learning rails for a while but I have only started on a real project last week. So far everything as been going great except for multi-model forms.
I learned loads of things from Ryan Bates tutorials, but his 3 forms screencast + other readings where not enough to make me understand how_forms_work in rails. I have read about presenter pattern, but my problem is not solved with that because of messy db relationships.
Can someone just help me and direct me to a learning resource where I can rapidly solve this. The project is due on Monday and there's still a lot of web design (css/html) to be made, so the code should be finished by now
So that you guys can understand the problem a little better this is what I have now. Basically a user can launch a Assignment and other users can Group up (users are only allowed to have one group) and submit a response (Submission) to that project. A Submission in a bunch of files grouped by Container (containers declare the file type and are specific to each Assignment: ex. 'source code', 'report', 'presentation')
[code=Group.rb]class Group < ActiveRecord::Base
[code=User.rb]class User < ActiveRecord::Base
[code=Assignment.rb]class Assignment < ActiveRecord::Base
[code=Submission.rb]class Submission < ActiveRecord::Base
[code=Container.rb]class Container < ActiveRecord::Base
[code=SubmissionFile.rb]class SubmissionFile < ActiveRecord::Base
## attachment_fu, multipart html?
has_attachment :storage => :file_system,
:max_size => 500.kilobytes
Given all this all I'm trying to do is a new form for users to submit their responses (submissions) to the assignment. First they select the assignment and press go. Then a form would ask for files as group id is a given
submission.group.id = User.find_by_id(session[:user]).group_id
For each container in that assignment users could add files to that container. The problem is that attachment_fu requires multipart, so i suppose i have to call the submission.file.new for each file added to container. Then another problem is I'm unsure about the database model. I know it's ok but is it ok for rails? It this the easiest way to do it? Is has_many_through an possible answer?!
If you can just give me a place to learn about this I would be very grateful.
Last edited by dscape (2008-02-09 13:33:33)